PankaJ D

PankaJ D

  • NA
  • 154
  • 0

DataAdapter Code

Mar 10 2010 2:09 AM

I need to insert data using dataAdapter. I have using following code. Isthis code iscorrect or nt??
<<<<<<<<<<<<<<<<<<

private void btnSave_Click(object sender, EventArgs e)
{
SqlConnection cn;

string cnstring = "server=(local)\\SQLEXPRESS;Database=Test;Integrated Security=True";

cn = new SqlConnection(cnstring);

string sql;
sql = "insert into Insert1 values('" + txtname.Text + "'," + txtrno.Text + ",'" + txtadd.Text + "','" + cmdgender + "')";

cn.Open();
SqlDataAdapter da = new SqlDataAdapter(sql, cn);


cn.Close();


}

>>>>>>>>>>>>>>>>

Answers (2)