iam getting an error as"An exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll but was not handled in user code
Additional information: Incorrect syntax near the keyword 'user'.
namespace emp
{
public partial class details : System.Web.UI.Page
{
SqlConnection con = new SqlConnection("Data Source=SRINU-PC\\sqlexpress;Initial Catalog=register;Integrated Security=True");
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
con.Open();
SqlCommand cmd = new SqlCommand("insert into user values ('" + TextBox1.Text + "''" + TextBox2.Text + "''" + TextBox3.Text + "''" + TextBox4.Text + "''" + TextBox5.Text + "')", con);
cmd.ExecuteNonQuery();
con.Close();
Label1.Text = "Values are Inserted";
}
}
}

Ravi PatelRank #439 · 5.7K reputationPosted Oct 14, 2015, 1:00 AM EDT
Srinivas Rao53 reputationPosted Oct 14, 2015, 2:09 AM EDT
ename nvarchar(50)
address nvarchar(50)
Ravi PatelRank #439 · 5.7K reputationPosted Oct 14, 2015, 3:36 AM EDT