CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Threaded View

  1. #1
    Join Date
    Mar 2004
    Posts
    28

    "Multiple-step OLE DB ... errors" on ADO PutValue

    [VC++ 6.0, SQL Server]
    I get the this error when I execute the last line of the following code:

    "Multiple-step OLE DB operation generated errors. Check each OLE DB value, if available. No work was done."
    Code:
    CString csState = "MA";
    BYTE* bt = new BYTE [256]
    	for (int i = 0; i < 256; i++)  //my initialization for testing
    	{
    		bt[i] = i + 1;
    	}
    BSTR bstrBuff = SysAllocStringLen((LPOLESTR)bt,256);
    
    pRst->Fields->GetItem("state")->Value = (_bstr_t) csState;
    pRst->Fields->GetItem("data")->Value = bstrBuff;
    The assignment of 'state' [varchar(2)] is OK. When csState has 3 characters, I get the same error.

    A recurring theme in the forum(s) for this error around this kind of operation is:
    the value is not suitable for the field to store.

    The database field 'data' is declared as varchar(600). I also tried varbinary(600).

    So, I am at a loss for an explanation.

    Thanks for any thoughts,

    jim

    EDIT: corrected the bug in my code example.
    Perhaps a buggy example doesn't warrant a response.
    I am completely stalled on this.
    Does any body have an idea?
    Thanks,
    jim
    Last edited by joleary; January 28th, 2007 at 10:42 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured