am using C#, VS-2005, and SQL-2000
am trying to insert into sql database via following.
but it's gives "incorrect syntex error near values"
I don't know what's wrong with the code please help me.
am trying to insert into sql database via following.
Code:
StringBuilder sb = null;
sb = new StringBuilder();
sb.Append("insert into dummy(name,amount)values");
foreach (Control ctl in this.flowLayoutPanel1.Controls)
{
if (ctl.Name.Contains("tb") && ctl is TextBox)
{
sb.Append(ctl.Text);
}
}
foreach(Control bbl in this.flowLayoutPanel1.Controls)
{
if(bbl.Name.Contains("bb") && bbl is TextBox)
{
sb.Append(bbl.Text);
}
}
SqlCommand cmd1 = new SqlCommand(sb.ToString(), con);
cmd1.CommandType = CommandType.Text;
cmd1.ExecuteNonQuery();
I don't know what's wrong with the code please help me.
Comment