111,125
社区成员
发帖
与我相关
我的任务
分享
OleDbConnection mdb;
SqlTransaction tran = null;
SqlCommand cmd = null;
OleDbDataAdapter da = null;
DataSet ds = null;
DataRow dr = null;
string ids = null;
try
{
ds = new DataSet();
da = new OleDbDataAdapter("select top 30 SmsIndex,SendNumber,SmsContent,SmsTime,Receiver from RecvSmsTable where NewFlag <>2 and rtrim(RecvSetIndex)<>'IP'", mdb);
da.Fill(ds); //在这行总是提示“Fill: SelectCommand.Connection 属性尚未初始化。”
}
catch (System.Exception e)
{
ConfigSettings.Log("上行信息错误!原因:" + e.ToString());
MessageBox.Show("上行信息错误!原因:" + e.ToString());
return;
}
Console.WriteLine("***** Fun with Data Adapters *****\n");
// Hard-coded connection string.
string cnStr = "Integrated Security = SSPI;Initial Catalog=AutoLot;" +
@"Data Source=(local)\SQLEXPRESS";
// Caller creates the DataSet object.
DataSet ds = new DataSet("AutoLot");
// Inform adapter of the Select command text and connection.
SqlDataAdapter dAdapt =
new SqlDataAdapter("Select * From Inventory", cnStr);
// Fill our DataSet with a new table, named Inventory.
dAdapt.Fill(ds, "Inventory");OleDbConnection mdb;
SqlTransaction tran = null;
SqlCommand cmd = new SqlCommand("select top 30 SmsIndex,SendNumber,SmsContent,SmsTime,Receiver from RecvSmsTable where NewFlag <>2 and rtrim(RecvSetIndex)<>'IP'");
OleDbDataAdapter da = null;
DataSet ds = null;
DataRow dr = null;
string ids = null;
try
{
ds = new DataSet();
da = new OleDbDataAdapter(cmd, mdb);
da.Fill(ds); //在这行总是提示“Fill: SelectCommand.Connection 属性尚未初始化。”
}
catch (System.Exception e)
{
ConfigSettings.Log("上行信息错误!原因:" + e.ToString());
MessageBox.Show("上行信息错误!原因:" + e.ToString());
return;
}