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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:20:40+00:00 2026-06-04T16:20:40+00:00

I am using an ODBC connnection to connect to a database. When I execute

  • 0

I am using an ODBC connnection to connect to a database. When I execute OdbcCommand.ExecuteNonQuery with an insert statement, the records are inserted into the table, but the method returns 0.

ExecuteNonQuery returns the number of records affected. It’s working fine in case of Delete and Update but not working in case of Insert.

query = "Insert into table1 (field1, field2) values (1,2)";

OdbcConnection = _remoteconn = new OdbcConnection(constring);
OdbcCommand cmd = new OdbcCommand(query, _remoteconn);
recordsAffected = cmd.ExecuteNonQuery();
  • 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-04T16:20:41+00:00Added an answer on June 4, 2026 at 4:20 pm

    ODBC is not a driver – it is a wrapper around a driver. The answer to this question is going to depend on the underlying ODBC driver that you are using, which would typically be specified in the Connection String.

    The MSDN documentation is really more of an expectation or a suggestion, but the ODBC interface cannot force the driver to return a particular result. It may be that the driver has some optimizations or settings which are interfering with your results, not unlike SQL Servers NO COUNT setting (which would override a driver’s attempts to report affected rows, etc).

    See wikipedia for a more thorough explanation of how ODBC works:
    http://en.wikipedia.org/wiki/ODBC

    “Because different technologies have different capabilities, most ODBC drivers do not implement all functionality defined in the ODBC standard. Some drivers offer extra functionality not defined by the standard.”

    If you tell us which driver you are using, it may help to find a solution.


    EDIT

    To the best of my knowledge, the ODBC API function in question is the SQLRowCount function, as defined here:
    http://msdn.microsoft.com/en-us/library/windows/desktop/ms711835(v=vs.85).aspx

    According to the ODBC standard, this function must be implemented for a driver to be considered ODBC-compliant. (That is not to say that the function will return the expected or correct result, just that it’s there).

    According the Transoft documentation (page 67) I’ve been able to dig up the SQLRowCount function was implemented. There is no mention of this function in any way being disabled or of any required configuration.

    Given the above, I would contact the vendor directly. It would appear that there is an error in their implementation or an undocumented “feature”.

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

Sidebar

Related Questions

I'm trying to connect to a MySQL 5 database using the MySQL ODBC 5.1
Im using sun.jdbc.odbc.JdbcOdbcDriver to connect to an oracle database.I know I would be probably
I'm using MySQL ODBC 5.1 driver under Windows to connect to my database. In
I am trying to insert values into Oracle 10g database using the code below
I've been writing a multi-threaded DLL for database access using ADO/ODBC for use with
I'm trying to connect to a MySQL database using my ASP.NET Web Forms Application.
I'm trying to connect my application with an Oracle database using NHIBERNATE 3.1.0.4000 version
I've been trying to connect Excel to online mysql database. Im using 5.1 DSN
I have the following problems with using ODBC driver with MS Access database my
I am using ODBC to connect to a Sybase databse. The problem is the

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.