帮忙看看错在哪了
[WebMethod]
public string HelloWorld()
{
string s = "";
OleDbConnection nwindConn = new OleDbConnection("Provider=SQLOLEDB.1;Password=1;Persist Security Info=True;User ID=sa;Initial Catalog=SMS;Data Source=127.0.0.1");
OleDbCommand catCMD = nwindConn.CreateCommand();
catCMD.CommandText = "select * from sysobjects";
nwindConn.Open();
OleDbDataReader d = catCMD.ExecuteReader();
s = d.GetSchemaTable().DataSet.GetXml();
nwindConn.Close();
return (s);
}
用途很简单, 就是将查询到的数据用XML的格式输出,可为什么执行到s = d.GetSchemaTable().DataSet.GetXml();时出错,跟踪后发现,s = d.GetSchemaTable().DataSet值为空,请问为什么?