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 8451393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:13:39+00:00 2026-06-10T11:13:39+00:00

I am declaring a string that is basically a list of designators, where yy

  • 0

I am declaring a string that is basically a list of designators, where yy is alpha and xxxx is numeric.

string sMyString = "('yy-xxxx','yy-xxxx','yy-xxxx','yy-xxxx','yy-xxxx','yy-xxxx')";

if(File.Exists(sFileLocation + sFileName))
{
    txtRunning.Text = "Starting db copy";
    File.Copy(sFileLocation + sFileName, sFileName, true);
    File.Copy(sDbLocation + "clipper.dbf", "clipper.dbf", true);
    File.Copy(sDbLocation + "clipper.dbt", "clipper.dbt", true);

    txtRunning.Text = "Starting datatable population";
    string connString = @"Provider=VFPOLEDB;Data source=.\clipper.dbf";
    string mySelectQuery = "SELECT UPPER(TRIM(field1))," +
        " UPPER(TRIM(field2)), UPPER(TRIM(field3)), UPPER(TRIM(field4))" +
        " FROM `clipper` WHERE condition1 AND field1 IN " + sMyString +
        " ORDER BY field2;";

    DataTable dtClipper = new DataTable();
    DataTable dtNotFound = new DataTable();
    DataTable dTable = new DataTable();

    OleDbConnection conn = new OleDbConnection(connString);
    OleDbDataAdapter adapter = new OleDbDataAdapter();
    adapter.SelectCommand = new OleDbCommand(mySelectQuery, conn);
    adapter.Fill(dtClipper);
}

If I take out the parens, I get an error in a dataadapter.fill command, saying the function does not exist. I get the same error if I change it to a string literal, with or without the parens. If I leave it as is, with the parens and single quotes, it runs just fine.

I need it to be just the list, without the single quotes as I’m adding them to a dictionary to use as an incidence counter. What is it I’m missing?

  • 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-06-10T11:13:41+00:00Added an answer on June 10, 2026 at 11:13 am

    That error is because you are using that string to run a SQL query, and without the quotes and parens, it’s invalid sql.

    You need to retain the quotes and parens in order for your SQL query to work. If you also need to have access to the list as plain strings, then store it as a list.

    List<string> myStrings = new List<String> {
        "yy-xxxx",
        "yy-xxxx",
        "yy-xxxx",
        "yy-xxxx",
        "yy-xxxx",
        "yy-xxxx"
    };
    string myStringsForSQL = string.Join(myStrings, "','");
    
    string mySelectQuery = "SELECT UPPER(TRIM(field1)), " +
        "UPPER(TRIM(field2)), UPPER(TRIM(field3)), UPPER(TRIM(field4)) " +
        "FROM `clipper` WHERE condition1 AND field1 IN ('" + myStringsForSQL + "') " +
        "ORDER BY field2;";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am declaring a SQL string that looks something similar to the following: string
I'm declaring a String array of [2][5]. Up until that point everything is fine.
Is it normal, that declaring NSString c=a sample string; cannot work, and must declare
I have a class that has a method as follows :- public void setCurrencyCode(List<String>
I wish to define a type String such that declaring a variable of type
I'm having difficulty declaring an element that contains a text string and has two
is there's any difference between declaring an arrayList polymorphically like that: List<Integer> iL =
In my application i'm declaring a string variable near the top of my code
It seems that there are two different ways of declaring sorted associations in Grails
I've got a method that returns a List for a DataSet table public static

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.