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();

Dharmraj ThakurRank #577 · 4.2K reputationPosted May 2, 2017, 9:39 PM EDT
Manas MohapatraRank #182 · 13.2K reputationPosted May 2, 2017, 9:45 PM EDT
Rafnas T PRank #280 · 8.8K reputationPosted May 2, 2017, 11:02 PM EDT
Catcher WongRank #286 · 8.8K reputationPosted May 2, 2017, 11:45 PM EDT
Jitendra ShekhawatRank #1,909 · 772 reputationPosted May 3, 2017, 4:22 AM EDT