我正在尝试使用单个命令对象从2个访问表中选择数据。这是我的代码 -
using (OleDbCommand cmdCommand=new OleDbCommand())
{
cmdCommand.CommandType = CommandType.Text;
cmdCommand.CommandText = "select * from tableA;select * from tableB";
cmdCommand.Connection = Connection;
using (OleDbDataAdapter daData=new OleDbDataAdapter())
{
daData.SelectCommand = cmdCommand;
Connection.Open(); daData.Fill(ds); Connection.Close();
}
}
但它会抛出异常“在sql语句结束后找到的字符。” 任何建议?