I can run the following statement in Query Analyzer and get the result I am looking for. However, when I run it in VB.NET, I get no results. Why?
SELECT STR_NAM From LocID Where STR_NAM like '%ROAD%'
Public Shared Function GetLocs() As DataSet
' Return set of locations based on search criterion entered on LocInqScreen
' Create a connection to the Mobile SQL database
Dim PAConnection As New SqlCeConnection
PAConnection.ConnectionString = "Data Source =""Program Files\HTE_Apps\CT Database.sdf"""
' Define a Query and Adapter to select this screen's controls from the database
'Define select string
Dim SelectLocs As String = "SELECT STR_DIR as DIR, STR_NUM as NUM, STR_NAM as STREET, STR_SFX as SFX, CITY, STATE, ZIP, LOC_ID From LocID Where"
'Define select string for each search criteria entered
If LocInqScreen.gSTR_NAM > "" Then
SelectLocs = Trim(SelectLocs) + " STR_NAM like '%" + Trim(LocInqScreen.gSTR_NAM.ToString) + "%' "
Dim adapter As SqlCeDataAdapter = New SqlCeDataAdapter(SelectLocs, PAConnection)
' Initiate a Dataset to contain the table returned
Dim result As New DataSet
'Fill the dataset
' Return the dataset