Error:
Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll
Additional information: Incorrect syntax near the keyword 'Table'.
CODE:
string ConnectionString = "Data Source=LocalHost;Initial Catalog=radiant;Integrated Security=True;Pooling=False";
SqlConnection objconnection = new SqlConnection(ConnectionString);
objconnection.Open();
// fire the command object
string strInsertCommand = "Insert into table [Table ] Values('"
+ tbun.Text + "','"
+ cbcountry.Text + "','"
+ gender + "','"
+ hobbies + "',"
+ rbmarried.Checked + ")";
SqlCommand objCommand = new SqlCommand(strInsertCommand, objconnection);
objCommand.ExecuteNonQuery();
objconnection.Close();
Jitendra ShekhawatPosted May 3, 2017, 8:22 AM
Catcher WongPosted May 3, 2017, 3:45 AM
Rafnas T PPosted May 3, 2017, 3:02 AM
Manas MohapatraPosted May 3, 2017, 1:45 AM
Dharmraj ThakurPosted May 3, 2017, 1:39 AM