Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
5
Reply
Error near objCommand.ExecuteNonQuery();
Prudhvi Raj
May 3 2017 1:18 AM
232
Reply
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();
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
5
)
Next Recommended Forum
Machine Learning for running a sql query
Set time for Sending Mail