I am trying to add some data into my database. I have 5 columns which all allow null values and all have datatype of varchar
. But in my program I am passing only 4 values and fifth column should be empty. When I do this shows error
Number of supplied values does not match in the number of databse columns
How can I add NULL
values into database?
My button click
protected void Button1_Click(object sender, EventArgs e)
{
try
{
string str=mas.empdetedit(ddid.SelectedItem.Text,txtname.Text,txtcon.text,txtval.text);
}
My class is
public string empdetedit(string id, string name, string con, string val)
{
string str=insert into table values('"+id+"','"+name+"','"+con+"','"+val+"'");
conn.nonquery(str);
}