关于sda.Fill(ds)出错的问题
代码如下:SqlConnectionconn;DataSetds;SqlDataAdaptersda;stringConStr="server=(local);datab...
代码如下:
SqlConnection conn;
DataSet ds;
SqlDataAdapter sda;
string ConStr = "server=(local);database=limbo_DB;uid=sa;pwd=itc123!@#";
conn = new SqlConnection(ConStr);
conn.Open();
string sql="select * from Test_0 where Person=" + comboBox1.SelectedText;
sda = new SqlDataAdapter(sql,conn); //定义一个数据适配器
ds = new DataSet();
sda.Fill(ds); // 行1
运行到行1就会报错,报错信息为
Incorrect syntax near '='.
求解! 展开
SqlConnection conn;
DataSet ds;
SqlDataAdapter sda;
string ConStr = "server=(local);database=limbo_DB;uid=sa;pwd=itc123!@#";
conn = new SqlConnection(ConStr);
conn.Open();
string sql="select * from Test_0 where Person=" + comboBox1.SelectedText;
sda = new SqlDataAdapter(sql,conn); //定义一个数据适配器
ds = new DataSet();
sda.Fill(ds); // 行1
运行到行1就会报错,报错信息为
Incorrect syntax near '='.
求解! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询