Search for a Single Word in a String

Does anyone know a command to search a string for a single word or phrase in Visual Studio In Excel, I use the following VBA code:

Cells.Find(What:=WordtoSearch, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, MatchByte:=False, SearchFormat:=False).Activate

But I can't figure out how to search a Access database using Visual Studio.

Any ideas




Answer this question

Search for a Single Word in a String

  • DiamonDogX

    Are you able to get information from the database (make a select statment)

    If not, there are some tutorial on the net:

    http://www.codeproject.com/aspnet/adodotnet.asp

    http://samples.gotdotnet.com/quickstart/howto/doc/adoplus/ADOPlusOverview.aspx

    If you can do a select statment, then you can research on how to create select, about the where clause

    http://www.w3schools.com/sql/default.asp

    (http://www.w3schools.com/sql/sql_where.asp, there is the like operator that will do the job).

    Or if your doing everything with dataset and want to filter your data after you got it: http://www.akadia.com/services/dotnet_filter_sort.html



  • Sai A

    Do you mean looking up a certain word or text in the Text editor... why dont you just do a find in the current document or maybe use CTRL + I to bring up the incremental search, this will highlight any text matching your input.

    hope this makes sense

    tribal


  • rod_r

    I am not trying to search in the text editor, but search through an Access database. My Visual Studio project will have a form (or textbox) that can accept an input, either a single word or phrase, then search through the data base for an exact or partial match.

    I just can't seem to find an equivalent code for the VBA example I listed above.



  • qrli

    You will have to open an ADO connection (search for ado.net) and then use SQL to query the data you want. It's not as easy as your previous method cause the application is not written directly in the database.

  • bilsa

    I got the ADO connection figured out, but I don't know much about SQL commands.

    What is the command to query



  • Search for a Single Word in a String