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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Objects and Variants (ADO)
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

jguenrdc

USA
Posts

Posted - 06/05/2006 :  4:41:33 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

ML

USA
63 Posts

Posted - 06/06/2006 :  11:26:14 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Jay,

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

ML
Go to Top of Page

jguenrdc

USA
Posts

Posted - 06/06/2006 :  4:10:22 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000