I cannot figure out why my update statement will not work? I figure it has to be something small that Im missing.
private void button2_Click(object sender, EventArgs e)
{
string strconn = "SERVER=15.5.7.9;User=sa;password=JFK3G785!340b;Database=addressstagingtable";
SqlConnection conn = new SqlConnection(strconn);
conn.Open();
try
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "UPDATE address" + "Set unitnumber =" + Addresstxt.Text + "WHERE streetnumber=148";
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
MessageBox.Show("Success");
}
}
catch (Exception)
{
MessageBox.Show("An error was generated, please contact your C.A.R.T.S System Administrator","MPL");
}
}