我正在尝试这种编码,这个编码中的错误是什么:
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Data Source =TWPL-PC\\SQLEXPRESS;Initial Catalog=TWPLSOFTWARE;Integrated security = True");
con.Open();
SqlCommand cmd = new SqlCommand("select ACC_ID ,ACC_TYPE ,ACC_ADD,ACC_CITY ,ACC_STATE ,ACC_COUNTRY ,ACC_TIN_N0 ,ACC_ECC_NO,ACC_RANGE,ACC_DIVISION ,ACC_COMMISS ,ACC_GST_NO ,ACC_CONTACT_PERSON ,ACC_PHONE_NO ,ACC_MOBILE_NO ,ACC_EMAIL ,ACC_PRICE_CODE ,ACC_APPROVAL_STATUS,ACC_PAN_NO from ACCOUNT where ACC_NAME='" + comboBox2.SelectedItem.ToString() + "'", con);
cmd.Parameters.Add(new SqlParameter("@ACC_NAME", comboBox2.SelectedItem.ToString()));
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
textBox17.Text = dr.GetString(0).ToString();
comboBox1.SelectedItem = dr.GetString(1).ToString();
richTextBox1.Text = dr.GetString(2).ToString();
textBox2.Text = dr.GetString(3).ToString();
textBox3.Text = dr.GetString(4).ToString();
textBox4.Text = dr.GetString(5).ToString();
textBox9.Text = dr.GetString(6).ToString();
textBox11.Text = dr.GetString(7).ToString();
textBox13.Text = dr.GetString(8).ToString();
textBox14.Text = dr.GetString(9).ToString();
textBox16.Text = dr.GetString(10).ToString();
textBox12.Text = dr.GetString(11).ToString();
textBox5.Text = dr.GetString(12).ToString();
textBox6.Text = dr.GetString(13).ToString();
textBox8.Text = dr.GetString(14).ToString();
textBox7.Text = dr.GetString(15).ToString();
textBox15.Text = dr.GetString(16).ToString();
//checkBox1.Checked=dr.GetString().ToString();
textBox10.Text = dr.GetString(18).ToString();
}
}
这是我的问题:
“数据类型text和varchar在等于中是不兼容的
运算符“。