Пожалуйста, помогите мне .......
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; using System.Configuration; public partial class _Default : System.Web.UI.Page { SqlConnection con = new SqlConnection(); string hin, mal, eng; protected void Page_Load(object sender, EventArgs e) { con = new SqlConnection(ConfigurationManager.ConnectionStrings["a"].ConnectionString); } protected void Button1_Click(object sender, EventArgs e) { con.Open(); if (FileUpload1.HasFile) { FileUpload1.SaveAs(Server.MapPath("~/img/") + FileUpload1.FileName); } if(checkbox1.Checked==true) { hin = "true"; } else { hin = "false"; } if (checkbox2.Checked == true) { mal = "true"; } else { mal = "false"; } if (checkbox3.Checked == true) { eng = "true"; } else { eng = "false"; } SqlCommand cmd = new SqlCommand("insert into a(name,age,gender,courses,language,image)values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + RadioButtonList1.SelectedItem.Value + "','" + DropDownList1.SelectedItem.Value + "','" + hin + "','" + mal + "','" + eng + "','" + FileUpload1.FileName + "')", con); int b = cmd.ExecuteNonQuery(); if(b>0) { Response.Write("inserted"); } } }
Что я уже пробовал:
я использую этот метод эта ошибка приходит
пожалуйста помогите мне
Invalid column name 'language'. There are fewer columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement.
Richard MacCutchan
Просто подсчитайте количество имен столбцов в вашем операторе и количество переменных.