解析查询时出错无法理解原因

时间:2013-04-27 08:24:24

标签: c# sql

 SqlCeConnection con1=new SqlCeConnection(@"Data Source=C:\\Users\\Ahmed\\documents\\visual studio 2010\\Projects\\WindowsFormsApplication6\\WindowsFormsApplication6\\Database1.sdf");
 con1.Open();

 SqlCeDataAdapter com1=new SqlCeDataAdapter("select * from Customer where Size No = "+textBox1.Text,con1);

 DataTable dt = new DataTable();
 com1.Fill(dt);

 dataGridView1.DataSource = dt;
 con1.Close();

1 个答案:

答案 0 :(得分:3)

因为Size No

它不应该有空格,只要是下划线或其他任何东西,只要它是你的列名。