Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

ADO using C++

Name: Anonymous 2006-10-04 12:04

Hey guys, I'm having a problem with ADO using C++, can anyone help?

The code is as follows:
_CommandPtr cmd;
cmd.CreateInstance(__uuidof(Command));
cmd->ActiveConnection = con; // con is the connection set up earlier
cmd->CommandType = adCmdText;
cmd->CommandText = "declare @sys_key varchar(10) set @sys_key=? select top 1 [sys_key], [value], [description] from system_directory order by sys_key";
cmd->Parameters->Append(
  cmd->CreateParameter(
    "@sys_key",
    adVarChar,
    adParamInput,
    10,
    NULL
    )
  );

  _variant_t var = "BM_PRINT";
  cmd->Parameters->Item[0]->Value = var; // FAIL!

  rec = cmd->Execute(NULL, NULL, -1);

But the line marked as FAIL, which is supposed to set the first (and in this case only) parameter to "BM_PRINT" throws an exception with error 0x800a0cc1, "Item cannot be found in the collection corresponding to the requested name or ordinal."

This doesn't make sense to me as I just created the parameter. Any ideas what's going on??

Name: Anonymous 2006-10-04 12:12

Note that the corresponding VBA code works fine:

Dim con As New Connection
With con
  .ConnectionString = "Provider=SQLOLEDB;Network Library=DBMSSOCN;Data Source=PFW-TEST;Database=DEVEL;Integrated Security=SSPI"
  .Open
End With

Dim cmd As New Command

With cmd
  Set .ActiveConnection = con
  .CommandType = adCmdText
  .CommandText = "declare @sys_key varchar(10) set @sys_key=? select top 1 [sys_key], [value], [description] from system_directory order by sys_key"
  .Parameters.Append cmd.CreateParameter("@sys_key", adVarChar, adParamInput, 10, Null)
  v = "BM_PRINT"
  .Parameters.Item(0).Value = v
  .Execute
End With

Name: Anonymous 2006-10-04 15:15

WAT R U DOIN

Name: Anonymous 2006-10-04 15:56

What is ADO?  Yet another Microsoft acronym for some useless proprietary "innovation"?

Name: Anonymous 2006-10-04 17:17

>>4

Active Data Objects. It's an object-orientated framework for accessing structured data sources like databases, excel files and stuff.

Anyway I got an answer from the newsgroups so DISREGARD THIS, I SUCK COCKS.

Name: Anonymous 2006-10-04 17:18 (sage)

>>4
ADO.NET is an Enterprise Grade Scalable Solution for High Availability Application Servers.

Name: Anonymous 2006-10-05 4:49

>>6

ADO.NET is different from ADO.

Name: Anonymous 2006-10-05 7:49

>>7
Not in the eyes of a Manager employing Best Practice Industry Standard techniques.

Name: Anonymous 2006-10-05 11:52

>>8

Stop wanking off to Slashdot and get a job

Name: Anonymous 2006-10-07 11:30

>>9
No, >>8 is right, so >>6 is

Name: Anonymous 2006-10-07 17:07

>>1
DON'T USE UNDERSCORES FOR VARIABLE NAMES OR CLASSES!!!!!!!!

Name: Anonymous 2006-10-08 4:57

>>11
__WHY NOT__?

Name: Anonymous 2006-10-08 7:38

>>12

__Pythonic?__

Name: Anonymous 2006-10-08 11:18

>>11


Complain to Microsoft

Name: Anonymous 2006-10-08 13:54

>>12
because you may clash with reserved keywords used by the compiler as defined by the standard, asswipe?

Name: Anonymous 2007-03-27 1:35 ID:Slgy1Uwy

RANDOM THREAD TO TOP!!

Name: AGAIN!! 2007-03-27 1:39 ID:Slgy1Uwy

RANDOM THREAD TO TOP!!

Name: Anonymous 2007-03-27 6:25 ID:W0ayN7Qc

I was about to answer this thread with a solution; then I realised with some amusement that it was one I posted ages ago.

Name: Anonymous 2007-03-27 6:31 ID:3JiU9Ljl

>>18
Has your more experienced self also realized that ADO is faggotry?

Name: Anonymous 2007-03-27 11:04 ID:W0ayN7Qc

>>19

It got the job done quicker than ODBC, and that's all that matters.

Name: Anonymous 2007-03-27 11:23 ID:VS7khHfl

>>20
Did it really?  I got an opportunity to use ODBC last week, and I had it set up working with my app in an hour or so!

Name: Anonymous 2007-03-28 5:59 ID:bFiVZPxa

>>21

Yes, I think mainly because I've had more experience using ADO (with VB, many times) than ODBC (with C, twice)

Name: Anonymous 2009-01-14 13:45

FIOC

Name: Trollbot9000 2009-07-01 8:47


Line my required info is in because  my daughter is  retarded she barks  like a seal  After i blow  my load in.

Name: Anonymous 2010-11-16 2:08

Name: Sgt.Kabu杇ԧkimanڰ奋 2012-05-28 20:29

Bringing /prog/ back to its people
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy

Don't change these.
Name: Email:
Entire Thread Thread List