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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:29:26+00:00 2026-05-26T16:29:26+00:00

I have that code : string query = select count(*) from MODEL m join

  • 0

I have that code :

string query = "select count(*) 
                  from MODEL m 
                  join KOLEKCJA ko on m.SEZON = ko.sezon 
             left join PRODUCENCI p on p.PRODUCENT_ID = m.PRODUCENT_ID 
             left join KRAJ k on k.KOD = m.KRAJ_POCH 
                 where ko.SEZON like :ko.SEZON 
                   and m.DO_PRODUKCJI like :m.DO_PRODUKCJI 
                   and k.KOD like :KOD 
                   and p.PRODUCENT_ID like :PRODUCENT_ID 
                   and m.MODEL_ID like :MODEL_ID";

OdbcCommand comm = new OdbcCommand();
comm.Connection = con;
comm.CommandText = query;
comm.CommandType = CommandType.Text;
comm.Parameters.AddWithValue("ko.SEZON", sezon);
comm.Parameters.AddWithValue("m.DO_PRODUKCJI", do_produkcji);
comm.Parameters.AddWithValue("KOD", kraj);
comm.Parameters.AddWithValue("PRODUCENT_ID", fabryka);
comm.Parameters.AddWithValue("MODEL_ID", model);

result = (int)comm.ExecuteScalar();

and always have error that parameters are not changed ;/
What do I wrong ?

  • 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-26T16:29:26+00:00Added an answer on May 26, 2026 at 4:29 pm

    ODBC connections do not work with named placeholders like the other connection types do. ODBC uses positional parameters marked by a question mark (?). Replace your bind variables with question marks and be sure to add your parameters in the correct order. The parameter name you pass to AddWithValue() can be anything. Like so:

    string query = "select count(*) 
                      from MODEL m 
                      join KOLEKCJA ko on m.SEZON = ko.sezon 
                 left join PRODUCENCI p on p.PRODUCENT_ID = m.PRODUCENT_ID 
                 left join KRAJ k on k.KOD = m.KRAJ_POCH 
                     where ko.SEZON       like ? 
                       and m.DO_PRODUKCJI like ? 
                       and k.KOD          like ? 
                       and p.PRODUCENT_ID like ? 
                       and m.MODEL_ID     like ?";
    
    OdbcCommand comm = new OdbcCommand();
    comm.Connection = con;
    comm.CommandText = query;
    comm.CommandType = CommandType.Text;
    comm.Parameters.AddWithValue("ko.SEZON", sezon);
    comm.Parameters.AddWithValue("m.DO_PRODUKCJI", do_produkcji);
    comm.Parameters.AddWithValue("KOD", kraj);
    comm.Parameters.AddWithValue("PRODUCENT_ID", fabryka);
    comm.Parameters.AddWithValue("MODEL_ID", model);
    
    result = (int)comm.ExecuteScalar();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following Java code: String query = Select 1 from myTable where
I have some code that looks like: static const std::string and( AND ); This
I have a C# application that includes the following code: string file = relativePath.txt;
I have the following code that sets a cookie: string locale = ((DropDownList)this.LoginUser.FindControl(locale)).SelectedValue; HttpCookie
I have a piece of C# code that needs to convert a string array
I have two string variables which are both file paths. The code that worked
I have a C# string object that contains the code of a generic method,
I have a data structure that represents C# code like this: class Namespace: string
I have some code in a python string that contains extraneous empty lines. I
I ran the following code in PHPAdmin's terminal: SELECT COUNT( * ) FROM User

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.