EStallworth
Well-known member
Can anyone tell me why this is not updating my SQL database.
VB.NET:
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] updatestatus [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] SqlClient.SqlCommand([/SIZE][SIZE=2][COLOR=#800000]"UPDATE Org SET Status ='@Status' WHERE AcctCode = '@AcctCode'"[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#0000ff]Me[/COLOR][/SIZE][SIZE=2].cn1) [/SIZE]
[SIZE=2]updatestatus.Parameters.AddWithValue([/SIZE][SIZE=2][COLOR=#800000]"AcctCode"[/COLOR][/SIZE][SIZE=2], ComboBox1.Text)[/SIZE]
[SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] Label67.Text = [/SIZE][SIZE=2][COLOR=#800000]"Active"[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Then[/COLOR][/SIZE]
[SIZE=2] updatestatus.Parameters.AddWithValue([/SIZE][SIZE=2][COLOR=#800000]"@Status"[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#800000]"I"[/COLOR][/SIZE][SIZE=2])[/SIZE]
[SIZE=2][COLOR=#0000ff]ElseIf[/COLOR][/SIZE][SIZE=2] Label67.Text = [/SIZE][SIZE=2][COLOR=#800000]"Inactive"[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Then[/COLOR][/SIZE]
[SIZE=2] updatestatus.Parameters.AddWithValue([/SIZE][SIZE=2][COLOR=#800000]"@Status"[/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#800000]"A"[/COLOR][/SIZE][SIZE=2])[/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Try[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff] Me[/COLOR][/SIZE][SIZE=2].cn1.Open()[/SIZE]
[SIZE=2] updatestatus.ExecuteNonQuery()[/SIZE]
[SIZE=2][COLOR=#0000ff]Catch[/COLOR][/SIZE][SIZE=2] ex [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] Exception[/SIZE]
[SIZE=2] MessageBox.Show(ex.Message)[/SIZE]
[SIZE=2][COLOR=#0000ff]Finally[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff] Me[/COLOR][/SIZE][SIZE=2].cn1.Close()[/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Try[/COLOR][/SIZE]