database connection problem

May 13 2008 5:28 AM

private void OnUpdateRichEdit(string msg)

{

SqlConnection con = new SqlConnection("server=localhost;initial catalog=online_application1;user id=sa;pwd=");

//richTextBox1.AppendText(msg);

rtrecvdata.Text = msg;

con.Open();

string st="insert into data(totaldata) values('" + rtrecvdata .Text + "') " ;

SqlCommand cmd = new SqlCommand(st, con);

cmd.ExecuteNonQuery();

con.Close();

}

for every one min data will come into this method,received data is saved in database.but problem is code is executed but data is not saved in database.

tell me the reason...


Answers (3)