Workin on a project for school.
I have a database called customers. A user logs into the system by entering their customer id and name. An SQL database on an SQL server should get checked to verify that the user is registered. I cant seem to find any information on how to write a statement that checks to see if the information is in the database at all.
Sql = "SELECT * FROM CUSTOMER " '& _
Cmd = New OleDb.OleDbCommand(Sql, Con)
Con.Open()
Reader = Cmd.ExecuteReader(CommandBehavior.CloseConnection)
If Reader.Read() Then
labeltext = Reader("First_name").ToString
labeltext &= Reader("Last_name").ToString
labeltext &= Reader("Company").ToString
Label2.Text = labeltext
End If
Ive been using the label2 to print out whats getting queried and right now when I run the script as is, I get First_name as a return. First_name is the headings of one of my columns. How the heck is that coming up? I would appreciate any help that I anyone could provide with an SQL statement to check the database for an existing name and customer number.
I have a database called customers. A user logs into the system by entering their customer id and name. An SQL database on an SQL server should get checked to verify that the user is registered. I cant seem to find any information on how to write a statement that checks to see if the information is in the database at all.
Sql = "SELECT * FROM CUSTOMER " '& _
Cmd = New OleDb.OleDbCommand(Sql, Con)
Con.Open()
Reader = Cmd.ExecuteReader(CommandBehavior.CloseConnection)
If Reader.Read() Then
labeltext = Reader("First_name").ToString
labeltext &= Reader("Last_name").ToString
labeltext &= Reader("Company").ToString
Label2.Text = labeltext
End If
Ive been using the label2 to print out whats getting queried and right now when I run the script as is, I get First_name as a return. First_name is the headings of one of my columns. How the heck is that coming up? I would appreciate any help that I anyone could provide with an SQL statement to check the database for an existing name and customer number.
