Im having problems with my insertcommand using odbcadapter, it doesnt insert the information I needed.. But the selectcommand works fine, only the insertcommand that is having problems..
heres my code..
Private Sub cmdLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdLogin.Click
a = Trim(txtStudNo.Text)
If Trim(txtStudNo.Text) = "" Or Trim(txtPword.Text) = "" Then
MsgBox("Please enter data on empty box")
ElseIf checkstr(a) <> 1 Then
' now we should query the records
record.SelectCommand = New OdbcCommand("SELECT * FROM studlogin WHERE studNo='" & txtStudNo.Text & "'", data)
ds = New DataSet
record.Fill(ds)
If ds.Tables(0).Rows.Count > 0 Then
dr = ds.Tables(0).Rows(0)
If UCase(txtStudNo.Text) = UCase(dr("studno")) And UCase(txtPword.Text) = UCase(dr("password")) Then
record.InsertCommand = New OdbcCommand("INSERT INTO studrecords (studno, course, time) VALUES('" & txtStudNo.Text & "','" & dr("course") & "','" & TimeOfDay & "')", data)
record.Update(ds)
MsgBox("Your now login")
cleartext()
Else
MsgBox("Wrong info provided!")
End If
Else
MsgBox("Register! Student Number doesnt exist")
End If
End If
data.Close()
End Sub