Searching for a keyword in a database using web services

srivalli

Well-known member
Joined
May 4, 2005
Messages
189
Programming Experience
Beginner
can we search for a keyword in a database(say access) using web services
if yes how?
can any one have idea on coding?
 
searching a word using Webservices

its easy, first of all you need to get a word (a String could be) as a parameter to your WebMethod and then use it to dig into you db.

like u can go like this
<WebMethod>
Public Function FindWord(word as String) as Boolean
'' make connection to DB'
'' use ExecuteScaler to find the word
'' return the appropriate response
end function

' i prefer to only return the indication but you can return any thing
 
Hi gripusa! How to use ExcuteAcaler to find word and return the appropriate? Any codes sample? What if i don't want to find the number of the search result, but display the information of the keyword. How to code? thankx.
 
He was trying to say how to find if certain word is existing in DB and that's why he used executeScalar statement as it always returns only one record (in this case the first one that would be found if one)

If you want to return the string then change the function ...

VB.NET:
Public Function findWord(ByVal str as String) As String
'' make connection to DB' 
'' use ExecuteScalar to find the word
'' return the appropriate response 
'note that all the time you need to use "str" as parameter in statements
End Function

Cheers ;)
 
Hi kulrom, for my proj the user need to key in the keyword like "the" and it will retrieve related keyword like "the ring", "lord of the ring". I had tired this sentance:


Dim enter AsString
enter = TextBox1.Text
Dim strSQL AsString = "SELECT * FROM movieDet WHERE title = '" + %enter% + "' "

Dim cmd AsNew OleDbCommand(strSQL, New OleDbConnection(strConn))

cmd.Connection.Open()


For this % character it says that it is a invalid character. But this is something i learn in sql statement. Is there any improve statement to solve this problem? Or is there another way to do the search engine? thankx

Regards,
tiffany
 
Back
Top