Hi
I am trying to check the database to see if there is a value year = '2004'...does anyone have any ideas how to do this?
Code is;
If DS.Tables("tblExpiryDate").Rows.Count > 0 Then
rsExpiry.DataSource = DS
rsExpiry.DataBind()
rsExpiry.Visible = True
Dim cmd As New SqlCommand("UPDATE tblExpiryDate SET ExpYear = ('" & txtYear.SelectedItem.Text & "'),ExpDate =('" & thisDate & "')", MyConnection)
cmd.ExecuteNonQuery
MyConnection.Close()
Response.write ("Update table")
Else
rsExpiry.Visible = False
Dim cmd As New SqlCommand("INSERT INTO tblExpiryDate (ExpYear, ExpDate) VALUES ('" & txtYear.SelectedItem.Text & "', '" & thisDate & "')", MyConnection)
cmd.ExecuteNonQuery
MyConnection.Close()
Response.write ("Insert table")
End If
Any help would really be appreciated
Thanks
Rachel
I am trying to check the database to see if there is a value year = '2004'...does anyone have any ideas how to do this?
Code is;
If DS.Tables("tblExpiryDate").Rows.Count > 0 Then
rsExpiry.DataSource = DS
rsExpiry.DataBind()
rsExpiry.Visible = True
Dim cmd As New SqlCommand("UPDATE tblExpiryDate SET ExpYear = ('" & txtYear.SelectedItem.Text & "'),ExpDate =('" & thisDate & "')", MyConnection)
cmd.ExecuteNonQuery
MyConnection.Close()
Response.write ("Update table")
Else
rsExpiry.Visible = False
Dim cmd As New SqlCommand("INSERT INTO tblExpiryDate (ExpYear, ExpDate) VALUES ('" & txtYear.SelectedItem.Text & "', '" & thisDate & "')", MyConnection)
cmd.ExecuteNonQuery
MyConnection.Close()
Response.write ("Insert table")
End If
Any help would really be appreciated
Thanks
Rachel