Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Help! Search string using ADO and SQL

Posted on 2000-05-11
4
Medium Priority
?
150 Views
Last Modified: 2010-05-02
Hi!!!
I would like to know if someome can help me to build a search string using ADO 2.1 , VB 6.0 and MS SQL 6.5 / 7.0.

I built this string:
    Rst.Open "SELECT * FROM Company WHERE Company = '" & ltCompany.Text & "'"

It works almost OK, but fail when I try to search for "World's Company"

with the following error:
ERROR  -2147217900(80040E14)

Thanks for any help
Regards,
Mrxz
0
Comment
Question by:mrxz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 6

Accepted Solution

by:
Marine earned 40 total points
ID: 2800540
   Rst.Open "SELECT * FROM Company WHERE Company = '" & Replace(ltCompany.Text),"'","''") & "'"
0
 
LVL 1

Expert Comment

by:simonstre
ID: 2800614
you must double the ' in Wordld's Company, in order to make the string looks like that :  "Worlds''s company"

0
 
LVL 1

Expert Comment

by:simonstre
ID: 2800617
sorry for the mistakes :-) I meant "World''s company"
0
 

Author Comment

by:mrxz
ID: 2800692
Thanks for help!
The syntax had an extra ")" closing the replace command.
But fits very well
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question