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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:36:33+00:00 2026-05-18T05:36:33+00:00

I am trying to insert data into MS SQL server 2008 using Ole DB.

  • 0

I am trying to insert data into MS SQL server 2008 using Ole DB. my insert procedure is:

ALTER PROCEDURE [dbo].[table_insert]
@category as bigint
AS
BEGIN
    INSERT INTO dbo.table
    (category)
    VALUES(@category)


    SELECT SCOPE_IDENTITY() as id;
END 

When I call the procedure, it is executed properly. New row is inserted. I use accessor to get new row id:

class DCCRetValueAccessor
{
public:
    __int64 id;

BEGIN_COLUMN_MAP(DCCRetValueAccessor)
    COLUMN_ENTRY(1, id)
END_COLUMN_MAP()

    void ClearRecord()
    {
        memset(this, 0, sizeof(*this));
    }
};

To execute the procedure and get new row id I use this code:

    CString cmd;
    __int64 newID = -1;

    cmd.Format(_T("EXEC [dbo].[alert_settings_insert] @category=%I64d"), value->category);

    CCommand<CAccessor<DCCRetValueAccessor>> command;

    if(DC_SUCCEEDED(command.Open(m_session, cmd)))
    {
        if(command.MoveFirst() == S_OK)
        {
        newID = command.id;

        }
        else
            return -1;
    }
    else
    {
        LogError();
        return -1;
    }
    return newID;

Problem is, that I get ASSERT error in method Bind() after calling GetInterface() in atldbcli.h, Line:6108, expression: GetInterface() != 0.

I cannot see the error. Can you help me please?
Thanks

  • 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-18T05:36:34+00:00Added an answer on May 18, 2026 at 5:36 am

    the solution is to add SET NOCOUNT ON; to the procedure like this:

    ALTER PROCEDURE [dbo].[table_insert]
    @category as bigint
    AS
    BEGIN
      INSERT INTO dbo.table
      (category)
      VALUES(@category)
    
    
      SELECT SCOPE_IDENTITY() as id;
    END 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to insert some text data into a table in SQL Server
I'm trying to insert into XML column (SQL SERVER 2008 R2), but the server's
I am trying to insert huge amount of data into SQL server. My destination
I am trying to insert Data into my Sql-Server database though C#. I'm Calling
Hello I'm trying to insert some XML data into a table on SQL Server
I am trying to insert a .csv file into SQL Server 2008 R2. The
I have a form that is trying to insert some data into an SQL
I am trying to insert a row of data into a table in SQL
I'm trying to insert data into the SQLite database using get EditText, but I
Getting a strange error when trying to insert data into an Access database using

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.