Hrm, I'm not at all sure my title is clear, but I spent 15 minutes trying to figure out what my real problem was. I'm new here, and brand new to VB and I'm only trying to access a database, search through it, and subsequently display it after the query has finished.
This calls...
Now, FillBy is my custom query, which reads:
I'm positive that my query here is the culprit. When I hit search I get no results no matter what. However, if I change '" & state & "' to something like 'NC' or 'TN', states that are in my database, it works just fine, pulling up the proper clients who live in those respective states.
Please tell me this is just a syntax issue, because I've been trying to get this VERY simple code to work for days and I'm pulling my hair out. Sorry for being such a newbie, but alas, I had to start somewhere.
If I'm completely leaving something out that you guys need to know, just tell me. It's 5:11 in the morning so I'm sure I forgot something.
Thanks in advance, really appreciate any help you guys can give me.
Code:
Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click Dim state As String state = StateTextBox.Text FindByState(state) If CustInfoDataSet.tblNames.Count = 0 Then MessageBox.Show("No records found.", "Search Results") End If End Sub
Code:
Private Sub FindByState(ByVal state As String) CustInfoDataSet.Clear() Me.TblNamesTableAdapter.FillBy(Me.CustInfoDataSet.tblNames) End Sub
Code:
SELECT fldKey, fldEmail, fldFirst, fldLast, fldHomePhone, fldWorkPhone, fldCellPhone, fldStreet, fldCity, fldState, fldPostalCode FROM tblNames WHERE (fldState = '" & state & "')
Please tell me this is just a syntax issue, because I've been trying to get this VERY simple code to work for days and I'm pulling my hair out. Sorry for being such a newbie, but alas, I had to start somewhere.
If I'm completely leaving something out that you guys need to know, just tell me. It's 5:11 in the morning so I'm sure I forgot something.
Thanks in advance, really appreciate any help you guys can give me.
Comment