我正在尝试使用单个命令对象从 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 语句结束后找到的字符”。有什么建议吗?