The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Objects and Variants (ADO)

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
jguenrdc Posted - 06/05/2006 : 4:41:33 PM
Origin Version: OriginPro 7.5 SR6 v7.5885(B885)
Operating System: Windows XP Pro SP2

I would like to work with an ADO Connection object and an ADO Command object. I have the following code:

static Object occnxn;
static Object occmd;
BOOL testCXN()
{
string strConn;
occnxn = CreateObject("ADODB.Connection");
if( !occnxn )
return FALSE;
strConn = "Provider=SQLOLEDB; Server=jayg; Database=flocis; User ID=jay; WSID=JAYG; Trusted_Connection=Yes";
occnxn.open(strConn);
occmd = CreateObject("ADODB.Command");
if( !occmd )
return FALSE;
occmd.ActiveConnection = occnxn; // ERROR HERE
/* more code later */
occnxn.Close();
return TRUE;
}

The line marked "// ERROR HERE" gives me this compile error:
Error, Incompatible variable types in expression

Microsoft's docs say the ActiveConnection property is expecting a variant. I am confused by their Visual C++ code example, however. Can anyone help me figure out how to make the ActiveConnection property assignment?

Jay
2   L A T E S T    R E P L I E S    (Newest First)
jguenrdc Posted - 06/06/2006 : 4:10:22 PM
I was able to find a workaround by using the Execute method of the ADO Connection object:

occnxn = CreateObject("ADODB.Connection");
if( !occnxn )
return FALSE;
strConn = "Provider=SQLOLEDB; Server=jayg; Database=flocis; User ID=jay; WSID=JAYG; Trusted_Connection=Yes";
occnxn.open(strConn);
occnxn.Execute("spChangePipeSize @HeaderID=1,@NewSize='20'",NULL,0x88);
occnxn.Close();

[not sure why the underline is there - j]

Jay

Edited by - jguenrdc on 06/06/2006 4:12:19 PM
ML Posted - 06/06/2006 : 11:26:14 AM
Hi Jay,

The assignment you are trying is not possible in 7.5. I can't think of a workaround.

ML

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000