Jump to content

SQL Query: INSERT INTO


LJnel

Recommended Posts

hey therewhen you use an INSERT INTO statement in sql, u fill the columns in the database with the values from a textbox or so on your registration page, like this...Dim myCommand As OleDbCommandmyCommand = New OleDbCommand("Insert INTO Dosent ( DosentNo, DnewPassword, DSecretquestion, DSecretanswer ) Values ( txtlectnewpassword.Text.Trim, ddbpasswordquestion.selecteditem.value, txtpasswordsecretanswer.text.trim )", myConnection)------------------------------------------------------------BUT, how do u get a value from a dropdownbox into the column in the database?? or am i using it right as i hav e shown here?------------------------------------------------------------myCommand.ExecuteNonQuery()myConnection.Close() :)

Link to comment
Share on other sites

OleDbCommand("Insert INTO Dosent ( DosentNo, DnewPassword, DSecretquestion, DSecretanswer ) Values ( txtlectnewpassword.Text.Trim, ddbpasswordquestion.selecteditem.value, txtpasswordsecretanswer.text.trim )", myConnection)
close but not quite.
OleDbCommand("Insert INTO Dosent ( DosentNo, DnewPassword, DSecretquestion, DSecretanswer ) Values ( '" & txtlectnewpassword.Text.Trim & "','" & ddbpasswordquestion.selecteditem.value & "','" & txtpasswordsecretanswer.text.trim &"' )", myConnection)

You can take out the (') if the column is not a string.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...