对于以下代码,我收到多步 OLE DB 操作错误。
适配器正在填充数据集时引发错误(在此行sAdapter.Fill(sDs, "Tran");
:)
OleDbCommand sCommand;
OleDbDataAdapter sAdapter;
OleDbCommandBuilder sBuilder;
DataSet sDs;
DataTable sTable;
OleDbConnection connection = new OleDbConnection();
connection = PEConnectionManager.ConnectionManager.GetConnection();
connection.Open();
string sql = "Select * Frequency from Tran where frequency=?";
sCommand = new OleDbCommand(sql, connection);
//string sfrequency = "Quarterly";
OleDbParameter param = new OleDbParameter("Quarterly", OleDbType.VarChar);
sCommand.Parameters.AddWithValue("frequency",param);
sAdapter = new OleDbDataAdapter(sCommand);
sBuilder = new OleDbCommandBuilder(sAdapter);
sDs = new DataSet();
sAdapter.Fill(sDs, "Tran"); // Error is thrown here...
sTable = sDs.Tables["Tran"];
sCommand.Prepare();
connection.Close();