lundi 1 février 2016

Checkbox not saving into database

I have my checkbox1 and when i checked it and save it to the database it should save "administrator" to my type column. But the problem is when i save it nothing happens and it shows no error in my if statement. but when i try my elseif and else statement it is saving perfectly into my database. i already converted my checkbox to a string.

 If ComboBox1.SelectedItem = "" And CheckBox1.Checked Then
            Query = "insert into database.logininfo (Username,Password,College,type) Values ('" & TextBox1username.Text & "','" & TextBox1pass.Text & "', '" & ComboBox1.SelectedItem & "', '" & type & "')"
            MessageBox.Show("Data Saved")

ElseIf ComboBox1.SelectedItem = "" Then
            MessageBox.Show("Please select a college")

 Else : Query = "insert into database.logininfo (Username,Password,College,Type) Values ('" & TextBox1username.Text & "','" & TextBox1pass.Text & "', '" & ComboBox1.SelectedItem & "')"
            MessageBox.Show("Data Saved")




Aucun commentaire:

Enregistrer un commentaire