i have a problem i can not see it
SqlConnection con = new SqlConnection();
con.ConnectionString = "Data Source=(local);Initial Catalog=MyDb;Integrated Security=True";
con.Open();
SqlCommand cmd = new SqlCommand("insert into User(Username,Password,Firstname,Lastname,Email) VALUES(@user,@pass,@fname,@lname,@emai)", con);
cmd.Parameters.AddWithValue("@user", TxtUserN.Text);
cmd.Parameters.AddWithValue("@pass", txtpass.Text);
cmd.Parameters.AddWithValue("@fname", txtFName.Text);
cmd.Parameters.AddWithValue("@lname", txtLName.Text);
cmd.Parameters.AddWithValue("@emai", TxtEmail.Text);
cmd.ExecuteNonQuery();
MessageBox.Show("You are registered");
I get a error saying that i have
An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll
Additional information:
Incorrect syntax near the keyword 'User'.
My db is
[ID]
,[Username]
,[Password]
,[Firstname]
,[Lastname]
,[Email]
FROM [MyDb].[dbo].[User]