当我在查询助手中测试时,为什么我的查询不起作用

时间:2013-03-17 12:36:08

标签: c# asp.net sql-server-2008-r2 using

protected void ASPxButton1_Click(object sender, EventArgs e)
{ 
   try {
      string turusec = ASPxComboBox1.SelectedItem.ToString();

      switch (turusec)
      {
         case "Laptop":
            SqlDataSource1.InsertCommand = "INSERT INTO Laptops(L_marka_ismi,L_marka_modeli,L_marka_quantity, L_marka_fiyati,L_marka_discount, L_marka_description, )" +
                    "VALUES('" + ASPxTextBox1.Text + "','" + ASPxTextBox2.Text + "','" + ASPxTextBox3.Text + "','" + ASPxTextBox4.Text + "','" + ASPxTextBox5.Text + "','" + ASPxMemo1.Text + "'))";
          break;

1 个答案:

答案 0 :(得分:1)

你有额外的',' (逗号)在字段列表的末尾(VALUES之前):

INSERT INTO Laptops(L_marka_ismi,L_marka_modeli,L_marka_quantity, 
L_marka_fiyati,L_marka_discount, L_marka_description**,**) VALUES...