I have a aspx page written in Vb and one of my button_click events has a function to connect to a sql database and retieve the data of a specific record by using the sql statement "SELECT * FROM Calendar WHERE Day="27" " The Name of my Table is Calendar. The RColum Names are Id ,Day ,Month and Year. If i use the sql statement and only write SELECT * FROM Calendar it finds the first record and i can use it but when i add WHERE i get an error saying "Cannot find column 27 and Cannot find column November and Cannot find column 2009 which is what im searching for ??? Any Ideas?
Dim frmDay As String = "27"
Dim frmMonth As String = "November"
Dim frmYear As String = "2009"
Dim strSql As String = ("SELECT * FROM Calendar;")
Dim con As New System.Data.SqlClient.SqlConnection
con.ConnectionString = *****
Dim myCommand As System.Data.SqlClient.SqlCommand
Dim myReader As System.Data.SqlClient.SqlDataReader
con.Open()
myCommand = New System.Data.SqlClient.SqlCommand(strSql, con)
myReader = myCommand.ExecuteReader
While myReader.Read()
If myReader(1).ToString = DrpDay.Text Then
If myReader(2).ToString = DrpMonth.Text Then
If myReader(3).ToString = DrpYear.Text Then
lbl1.Text = "The Date :" & myReader(1).ToString() & "/" & myReader(2).ToString & "/" & myReader(3).ToString
End If
End If
End If
End While
con.Close()