I am trying to insert into DB, it gets updated only when i goto table properties,
and press “Execute SQL”.
Here is the code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Web.Configuration;
using System.Configuration;
public partial class _Default : System.Web.UI.Page
{
String s;
SqlCommand cmd;
SqlConnection Con;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
s = WebConfigurationManager.ConnectionStrings["my"].ConnectionString;
Con=new SqlConnection(s);
Con.Open();
cmd=new SqlCommand("insert into stu values('"+TextBox1.Text+"','"+TextBox2.Text+"')",Con);
cmd.ExecuteNonQuery();
Con.Close();
}
}
What is wrong?It gets updated not Automatically,but when i goto the table contents,right click and press execute SQL.
UPDATE:
This will make things clear:

Only after this the row is affected.Any reasons?
UPDATE2
I know the the stmt. is working fine.But what can be the problem?Shoudn’t it update automatically?Why i have to go to “Execute SQL”??
I’m using sql server
In your question tag is given as ‘mysql’ but for me it looks as SQL server.
Your program is updating to database. But it will be visible only if you refresh the sql page.