Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 266969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T23:29:14+00:00 2026-05-11T23:29:14+00:00

I have a Pervasive database that I connect to using C++. All my queries

  • 0

I have a Pervasive database that I connect to using C++.
All my queries so far is parameterized, i.e "SELECT USER.NAME FROM USER WHERE USER.ID = ?",
and that works fine.
But in a search query I use LIKE in the WHERE clause, and then it seems I can’t use parameters and wild chars (%).

My query looks something like this "SELECT * FROM DOG WHERE DOG.NAME LIKE '%?%'" and since there are two ‘ around the parameter ?-mark, this fails, it searched for dogs with a ?-mark in their name. In SQL Server this would probably be solved by concatenating the string like "SELECT * FROM DOG WHERE DOG.NAME LIKE '%' + ? + '%'", but this is invalid syntax in Pervasive (see bottom of this page: http://ww1.pervasive.com/library/docs/psql/950/sqlref/sqlref-04-55.html).

I’ve also tried to add the %-signs to the parameter itself, but that doesn’t seem to work either.

Does anyone know a solution to this?

EDIT1:
Some C++ Code example:

CString sqlCommand = "SELECT * FROM DOG WHERE DOG.NAME LIKE ?;";
m_pAdoCommand->CommandText = _bstr_t(sqlCommand);
m_pAdoCommand->Parameters->Append( m_pAdoCommand->CreateParameter("p0", adVarChar, adParamInput, 25, _bstr_t("'%bob%'")) );
m_pAdoRecordset = m_pAdoCommand->Execute(NULL,NULL,adCmdText);

(m_pAdoCommand is a _CommandPtr, and m_pAdoRecordset is a _RecordsetPtr. I’ve changed the name of the SQL Tables in this example so that they make sens here.)

The above code will return a row with a dog that has the name '%bob%', but I would like it to return all dogs that have bob in their name.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T23:29:14+00:00Added an answer on May 11, 2026 at 11:29 pm

    Why don’t you add a wildcard to the value you’re assigning to the parameter ?

    So, this means, your query looks like

    SELECT * FROM dog WHERE dog.name LIKE ?
    

    And then, you assign the value ‘%bob%’ to this parameter, for instance.
    I see you say that you’ve tried this as well, but it doesn’t work, which is very strange. Can you show the code of what you’ve done then ?

    I also see that you put quotes around the parameter in one of your examples. This doesn’t sound like a good idea, since then the parameter won’t be recognized as a parameter anymore. At that point, it is just a string.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 209k
  • Answers 209k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The JAXP SAX api with SAX filter is both fast… May 12, 2026 at 9:46 pm
  • Editorial Team
    Editorial Team added an answer I would begin by examining any method that doesn't follow… May 12, 2026 at 9:46 pm
  • Editorial Team
    Editorial Team added an answer Django also has the dumpdata and loaddata commands in manage.py.… May 12, 2026 at 9:46 pm

Related Questions

I'm working on a little experimental utility to use within our company that indexes
I'm not sure if this is the best way to ask this question but
I'm asking this question because I was investigating the Haiku OS (a BeOS descendant).
Is there any solution to work with Btrieve/Pervasive db from Ruby level? Any gem?

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.