Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 sql search

Author  Topic 

tokm
Starting Member

1 Post

Posted - 2005-03-10 : 11:05:08
I'm having a problem using vb.net to search a Access database. When I execute the SQL in Access it works fine, but when its executed in vb.net I don't get any results...Here is the sql statement that I use.

Dim instSTR = "select Personnel.LastName, Personnel.SSN, StateSystem.personnelID FROM Personnel, StateSystem where (" & checkedSTR & " like '*" & SearchInputTXT.Text & "*') and (stateSystem.personnelID = personnel.personnelID)"

The checkedSTR will be Personnel.LastName
the SearchInputTXT.text will be the search term

Any help will be appreciated, i've been beating my head against the wall over this one!

ts_abbott@hotmail.com
Starting Member

36 Posts

Posted - 2005-03-10 : 18:39:17
quote:
Originally posted by tokm

I'm having a problem using vb.net to search a Access database. When I execute the SQL in Access it works fine, but when its executed in vb.net I don't get any results...Here is the sql statement that I use.

Dim instSTR = "select Personnel.LastName, Personnel.SSN, StateSystem.personnelID FROM Personnel, StateSystem where (" & checkedSTR & " like '*" & SearchInputTXT.Text & "*') and (stateSystem.personnelID = personnel.personnelID)"

The checkedSTR will be Personnel.LastName
the SearchInputTXT.text will be the search term

Any help will be appreciated, i've been beating my head against the wall over this one!



when you do the like comparison change '*yourvalue*' to '%yourvalue%'
Go to Top of Page
   

- Advertisement -