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

Related Questions

I need to import data from pervasive database to sql server. I have installed
Using Pervasive SQL, I have a result set: Tp_No Name State Eff_Date Actual Billed
Have some dates in my local Oracle 11g database that are in this format:
Have a fun issue with sharepoint calendar view filtering. That code works fine: SPSecurity.RunWithElevatedPrivileges(delegate()
We have a number of DTSX Packages that Extract-Transform-Load data from a number of
Have just started using Google Chrome , and noticed in parts of our site,
Have just started using Visual Studio Professional's built-in unit testing features, which as I
I have a stored proc, with joins like so: FROM Salesforce_Pervasive.dbo.Account a INNER JOIN
I'm wondering just how pervasive JavaScript is. This article states that 73% of websites
I'm working at a development shop that is using outdated bug tracking software. They're

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.