bhawna jain

bhawna jain

  • NA
  • 4
  • 0

data updation in sqlserver2005 c#

Jul 15 2008 7:32 AM

hi friends

i am new in web site devlopment . i got error in data updation coding . cauld u help me .

protected void update_Click(object sender, EventArgs e)

{

SqlDataReader rdr = null;

string myConnectString = "Data Source=NBAP25169578480;Initial Catalog=employee;Integrated Security=True";

SqlConnection con = new SqlConnection(myConnectString);

con.Open ();

SqlCommand cmd = new SqlCommand("update emp set where userid ="+TextBox3.Text+"",con );

rdr = new SqlDataReader ();

if(rdr.Read ())

{

cmd.Parameters.AddWithValue("@password", TextBox1.Text);

cmd.Parameters.AddWithValue("@userid", TextBox2.Text);

}

rdr = cmd.ExecuteReader();

// cmd.Connection = con;

cmd.Connection.Open();

// cmd.ExecuteNonQuery();

cmd.Dispose();

con.Close();

}

thanks

regards

bhawna


Answers (2)