| | |
Stored procedure call with ADO
![]() |
•
•
Join Date: Mar 2005
Posts: 1
Reputation:
Solved Threads: 0
Hello,
I am attempting to make a stored procedure call to an ADO. I will paste in the try loop. Problem is code compiles and runs, however; the stored procedure never runs. It's supposed to create a row in the DB, and the row is never created. If I run the proc in a SQL query session, it runs succesfully, so I know that the proc is good. If anyone could be of any help, I would appreciate it. I am using sample code that I found at another site, my first thought was that I may have to use another function, not execute(), I'm at a loss.......
<< moderator edit: added [code][/code] tags >>
I am attempting to make a stored procedure call to an ADO. I will paste in the try loop. Problem is code compiles and runs, however; the stored procedure never runs. It's supposed to create a row in the DB, and the row is never created. If I run the proc in a SQL query session, it runs succesfully, so I know that the proc is good. If anyone could be of any help, I would appreciate it. I am using sample code that I found at another site, my first thought was that I may have to use another function, not execute(), I'm at a loss.......
C Syntax (Toggle Plain Text)
try { HRESULT result; //Connect to database result = ::CoInitialize(NULL); if (FAILED(result)) throw HookException("COM initialize failed."); result = connection.CreateInstance(__uuidof(Connection)); if (FAILED(result)) throw HookException("Could not create connection instance."); result = connection->Open("DSN=WFC_DSN;UID=suprkron;PWD=skron96", "", "", adConnectUnspecified); if (FAILED(result)) throw HookException("Could not connect to database."); result = preparedCommand.CreateInstance(__uuidof(Command)); if (FAILED(result)) throw HookException("Could not create prepared command."); preparedCommand->CommandText = "NGP_VALLABORACCT"; preparedCommand->ActiveConnection = connection; preparedCommand->CommandType = adCmdStoredProc; //LL 1 vLl1.vt = VT_I2; vLl1.iVal = ll1; inputParam = preparedCommand->CreateParameter(_bstr_t("1"), adInteger, adParamInput, sizeof(int), vLl1); preparedCommand->Parameters->Append(inputParam); //LL 2 vLl2.vt = VT_I2; vLl2.iVal = ll2; inputParam = preparedCommand->CreateParameter(_bstr_t("2"), adInteger, adParamInput, sizeof(int), vLl2); preparedCommand->Parameters->Append(inputParam); //LL 3 vLl3.vt = VT_I2; vLl3.iVal = ll3; inputParam = preparedCommand->CreateParameter(_bstr_t("3"), adInteger, adParamInput, sizeof(int), vLl3); preparedCommand->Parameters->Append(inputParam); //LL 4 vLl4.vt = VT_I2; vLl4.iVal = ll4; inputParam = preparedCommand->CreateParameter(_bstr_t("4"), adInteger, adParamInput, sizeof(int), vLl4); preparedCommand->Parameters->Append(inputParam); //LL 5 vLl5.vt = VT_I2; vLl5.iVal = ll5; inputParam = preparedCommand->CreateParameter(_bstr_t("5"), adInteger, adParamInput, sizeof(int), vLl5); preparedCommand->Parameters->Append(inputParam); //LL 6 vLl6.vt = VT_I2; vLl6.iVal = ll6; inputParam = preparedCommand->CreateParameter(_bstr_t("6"), adInteger, adParamInput, sizeof(int), vLl6); preparedCommand->Parameters->Append(inputParam); //LL 7 vLl7.vt = VT_I2; vLl7.iVal = ll7; inputParam = preparedCommand->CreateParameter(_bstr_t("7"), adInteger, adParamInput, sizeof(int), vLl7); preparedCommand->Parameters->Append(inputParam); returnVal.vt = VT_I2; returnVal.iVal = 0; returnParam = preparedCommand->CreateParameter(_bstr_t("return"), adNumeric, adParamReturnValue, sizeof(_variant_t), returnVal); preparedCommand->Parameters->Append(returnParam); resultSet = preparedCommand->Execute(&rowsAffected, NULL, adCmdStoredProc); printf("Complete, rows effected: %d", rowsAffected.lVal); }
<< moderator edit: added [code][/code] tags >>
![]() |
Similar Threads
- How to call Stored Procedure using Class (PHP)
- MySQL Stored procedure call in c++ (C++)
- Stored Procedure Question (Pascal and Delphi)
- How to acces Command Object in ADO executeComplete event (C++)
- how to create-call stored procedure (PHP)
- PHP MSSQL Stored Procedure with Parameters (In and Out) (PHP)
- how to call Stored Procedure in mysql by php (PHP)
- How to connect a SQL stored procedure to a windows application? (VB.NET)
Other Threads in the C Forum
- Previous Thread: Reading Keypresses without a "return"
- Next Thread: Can someone help at least get started its due monday please
| Thread Tools | Search this Thread |
#include adobe ansi api array asterisks binarysearch changingto char character cm copyimagefile cprogramme creafecopyofanytypeoffileinc createcopyoffile csyntax database directory dynamic execv feet fgets file fork forloop frequency function getlasterror givemetehcodez global grade graphics gtkgcurlcompiling hacking hardware highest histogram i/o include incrementoperators infiniteloop input interest kernel keyboard kilometer license linked linkedlist linux linuxsegmentationfault list locate logical_drives looping loopinsideloop. lowest match matrix meter microsoft motherboard mqqueue mysql number odf opensource owf pattern pdf performance pointer posix probleminc process program programming radix recursion recv repetition research reversing scanf segmentationfault sequential shape socket socketprograming standard string systemcall threads turboc unix user voidmain() wab windows.h windowsapi




