If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Updating distinct data type column value using ADO

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-12-10, 06:13
salman83 salman83 is offline
Registered User
 
Join Date: Jan 2010
Posts: 4
Updating distinct data type column value using ADO

Hi,

I have created my distinct type as

CREATE TYPE UDTOBJECT AS VARCHAR(40) WITH COMPARISONS

and my table SQL is

CREATE TABLE T_TEST_RESULT(
Id INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY ( START WITH 1, INCREMENT BY 1, NO CACHE ),
object UDTOBJECT,
Date TIMESTAMP DEFAULT CURRENT TIMESTAMP,
CONSTRAINT CC1263817423857 PRIMARY KEY(Id) )




The problem is that when I try to update the field of distinct type column using ADO, it throws an error.

Description = [DB2/NT] SQL0432N A parameter marker or null value cannot have the user defined type name or reference target type name "UDTOBJECT". SQLSTATE=42841


Here is my ADO code.


ADODB::_RecordsetPtr ipRec;
ipRec.CreateInstance( __uuidof(ADODB::Recordset) );

ipRec->CursorLocation = ADODB::adUseClient;

ipRec->Open( "SELECT * FROM T_TEST_RESULT WHERE Id = 1",
(IDispatch *)ipConn,
ADODB::adOpenStatic,
ADODB::adLockOptimistic,
ADODB::adCmdUnknown );


if( (ipRec->BOF == VARIANT_TRUE) && (ipRec->EndOfFile == VARIANT_TRUE) )
{
printf( "No data....\n" );
return -1;
}


_variant_t vObject( "Hello World" );

ipRec->Fields->Item["object"]->Value = vObject;
ipRec->Update();



Any help will be highly appreciated.

Thanks in advance.

Regards.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On