How to open RecordSet with Stored Procedures (ODBC, VC++)

Hi
I'm using ODBC and VC++.
My stored procedure has parameters like @pstr VarChar(100), @pVal1
numeric(9), @pVal2 numeric(9) and it returns a recordset.

In my code

CString strSP;
strSP.Format("{call MySp('%s','%d','%d')}", str1, (long)Val1,
(long)Val2);
CMyRecorSet rs(m_db);
try
{
rs.Open(CRecordset::snapshot,strSP);
}
catch(CDBException * pDB)
{
}

I'm getting exception. Cannot covert datatype varchar to numeric.
Why is this happening?
Do i need to call SQLBindParameters?
If yes, how to call it. Any sample code?

Thanks in advance.

0
sanjutvm (2)
10/25/2005 6:29:01 PM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
370 Views

Similar Articles

[PageSpeed] 5

Remove the apostophe's from around the numeric parameters. 

"sanjutvm@gmail.com" wrote:

> Hi
> I'm using ODBC and VC++.
> My stored procedure has parameters like @pstr VarChar(100), @pVal1
> numeric(9), @pVal2 numeric(9) and it returns a recordset.
> 
> In my code
> 
> CString strSP;
> strSP.Format("{call MySp('%s','%d','%d')}", str1, (long)Val1,
> (long)Val2);
> CMyRecorSet rs(m_db);
> try
> {
> rs.Open(CRecordset::snapshot,strSP);
> }
> catch(CDBException * pDB)
> {
> }
> 
> I'm getting exception. Cannot covert datatype varchar to numeric.
> Why is this happening?
> Do i need to call SQLBindParameters?
> If yes, how to call it. Any sample code?
> 
> Thanks in advance.
> 
> 
0
scott7693 (519)
11/14/2005 6:56:03 PM
Reply:

Similar Artilces:

Invalid Procedure Call or Arguments
Hi, I got this error ("Invalid Procedure Call or Arguments") when run this code: 'Delete drawing files Set fs = CreateObject("Scripting.FileSystemObject") Set fld = fs.GetFolder(pubWorkingDir & "Drawings\") Set rsc = dbs.OpenRecordset("SELECT * FROM tblDrawings WHERE ID=" & tempItemID, dbOpenDynaset) rsc.MoveFirst Do While Not rsc.EOF If Dir(pubWorkingDir & "Drawings\" & rsc!DrawingFile) <> "" Then fld.Files(pubWorkingDir & "Drawings\" & rsc! DrawingFile).Delete True ...

Can't open my money file #2
Good evening, From today i can't open my money file, i had formatted my pc and i reinstalled money as usual. Today when i open my money file after typing the correct password the program show a screen where it say "Money has detected that you did not close file xxx before exiting Money now needs to verify the information in your file. .... Do you want do this now?" I click yes and it say "The email address or password is incorrect. Please try again" But i dont put nowhere any email address this is an old money file converted to new money 2008 un year ago i never ...

Outlook 2003 acquiring multiple instances of a message store
Hi, I've been working on a project involving a MAPI message store provider and I've noticed some peculiar behaviour with Outlook 2003. Specifically it seems that Outlook invokes the MSProviderInit() function on three separate occasions, and I'd like to understand why. The first two invocations occur directly after I access the message store for the first time. The third occurs some (indeterminate) time later (normally between 15 and 20 seconds after Outlook is launched). What on earth is it doing? Why does Outlook 2003 require three separate instances of a message store. This fun...

Export stored BMP's (receipts) out of SQL database
Hi, I'm looking for a possibility to export the stored transactions out of the database. I know there are several ways to cleanup the database by deleting old stored transactions (BMP's). Is there a way to export this to an alternate location? Is it also possible to do this for specific accounts? And for specific dates? Regards, Justin Janson Those records are encrypted images and as far as I know MS has never released any information that would allow them to be used outside the Journal Viewer. You could open them one at a time in Journal Viewer and print them to PDF, but th...

Underlying Connection was Closed when opening System Settings
I've seen a couple of threads on "Underlying Connection was Closed" when opening System Settings. I just found a solution not mentioned in those posts and thought I would add to the knowledge base. System Settings requires a connection to Microsoft SQL Reporting Server (SRS). If your SRS server is down or offline the above error will be displayed. Zack Jones Chief Architect Q1 Technology ...

difficulty opening e-mail attachments
I am unable to open attachments sent to me in my e-mail. Outlook Express indicates the attachments are "unsafe"and prevents me from opening them. Many of these attachments are sent to me by friends and I am sure there are no viruses associated with them. I have been unable to find out how to change any of the security settings within O.E. Does anyone out there have any advice? Try this site for information on removing the block: http://www.omegageek.com/OESecurity.htm This is a group to support Outlook from the Office group of programs. Outlook Express is a part of Int...

Exchange 2000
Hello, Does anybody know of search tool that can perform the following: 1. Search the Mailbox store directly, i.e., M: 2. We are interesting in search for From, To, Subject and Body and if possible attachment contents. 3. We would like to do one pass on the information store so we wish to be able to build a multiople search query, i.e., a) Search for "John" b) Search for person@domain.com c) Search for "HELLO" d) etc... 4. We would like to then be able to copy our findings to a folder or something.... It seems that the built in searchin...

Excel and open office
I have made an excel file and protected sheets in it and even hidden some of the worksheets with macros. But when i open the xls file in Open Office (linux) It shows all the worksheets and there is no protection. I dont want to display the hidden sheets in any OS(or Package). any work arounds? Kindly help Hi Priya, workaround: Don't use Open Office or pretend it doesn't exist. Open Office is a different software program, it can read Excel files but it is not Excel. It's great for recovery of Excel files. Possibly features of exposing data while helpful in some areas a...

Running an Excel Macro from VC++
Hi, I use Excel Automation from VC++. I would like to run a macro already stored in Excel on the workbook that I just created. I was thinking that _Application::Run() would do it but it doesnt' seem to find my macro. The macro is stored under the name PERSO.XLS!Macro1. Run doesn't seem to find it. Even if I user Macro1 as an argument, I still can't run this macro. Any ideas why ? Cheers. ...

PUB file crashes Publisher on open
I have a publisher file that crashes MS Publisher on open, even tried some recovery programs and they crashed. Is it a lost cause? How to troubleshoot a damaged publication in Publisher http://support.microsoft.com/kb/198256/en-us -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com http://officebeta.iponet.net/en-us/publisher/FX100649111033.aspx <dmahlitz@gmail.com> wrote in message news:1161174335.508250.183640@m73g2000cwd.googlegroups.com... >I have a publisher file that crashes MS Publisher on open, even tried > some rec...

Why The DB Must Be Open????
Hi, when i run that pro and the DB close I get Error: 2075 "this operation requires an open database" when i open the data base is work. The code: Private Sub Command1_Click() Dim cn As ADODB.Connection Dim sPath As String Set cn = New ADODB.Connection cn.Open "DSN=TEST1" sPath = "D:\ImportCurrencyRate.xls" DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "Temp_Rates", sPath, True End thanks. > Why The DB Must Be Open? > when i run that pro and the DB close I get Error: 2075 > "this operation requires an open database&quo...

Excel: Open Recent Files
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel I can't get the list to change. It continues to list the same 10 files all the time. <br><br>If I delete the Microsoft Preferences file, i.e. com.microsoft.Excel.plist, the next time I start up Excel, the same 10 files are there. <br><br>If I open several new files, they initially get added to the list. However, once again, once I re-start Excel, the original 10 files are still there. <br><br>If I turn off the recently opened list in the Excel General preferences, delete ...

Using <Ctrl>-Click to open files
When using <Ctrl>-Click to open multiple files from the File/Open dialog in Excel 2003, only the first file will appear on the taskbar. A combo-box type Taskbar selector for multiple Excel files does *not* appear. Also, only the first file appears on the <Alt>-<Tab> menu. However, all files appear in the Excel Window menu. The problem also occurs when using <Ctrl>-Click/Right- Click/Open to open multiple files from Windows Explorer or My Computer. The problem does not occur when opening the files individually. Is this a known problem? Is there a fix? Thanks! ...

budget won't open in Money 2004
Hi there, I have Money 2004 (oem) on my computer here at work. I've opened my money file that I created at home using Money 2003. The file opens okay (it seems to go through the conversation function just fine), but I cannot access the budget. I can check out everything else: account list, bills, cash flow, etc. But when I click on "Budget" absolutely nothing happens. Can you open the budget if you create a new file? I'm guessing you can. Why you may want to try is to create a new budget on your home file and with that as the active budget, try to convert that file o...

Ports to open for OWA
I have a basic router/firewall which I'm trying to access OWA though. Internally it works fine but from the outside I get a "page cannot be displayed" I have forwarded ports 80, 442, and 135. Am I missing something? Thanks, "Peretz Stern" <peretzstern@optonline.net> wrote: >I have a basic router/firewall which I'm trying to access OWA though. >Internally it works fine but from the outside I get a "page cannot be >displayed" I have forwarded ports 80, 442, and 135. Am I missing something? Yes. Don't allow port 135 unless you ...

excel opens slow
is there a way to increase the speed that excel open.? its funny. all for the other programs such as MS Office XP Word and soforth and even the application that does not relates to MS Office XP opens fast. when trying to observe the process of excel i saw that it goes through Virous scaning and networking which I dont have. what can I do to speedup the opening process of MS Office XP Excel? "Colin2u" <Colin2u@discussions.microsoft.com> wrote in message news:B4BEA78C-4009-48F0-B0F5-EF63AFBBD3AF@microsoft.com... > is there a way to increase the speed that excel open.? ...

-ERR mailbox could not be opened
Windows 7 Ultimate x64; Windows Live Mail Client; all updates applied. Have 1 'Hotmail' & 2 'Live' accounts, all set up in WLM using pop3.live.com / smtp.live.com settings. Been working fine up until yesterday. One of the 'Live' accounts will not sync anymore. Error message as follows (account name masked out): --------------------------------------------------------------------------------------------- Unable to send or receive messages for the Live (*************) account. An incorrect password was entered. The next time you send or receive message...

Excel 2K3: Opening a spreadsheet, also opens book1.xls?
I double click on a spreadsheet and it opens, but it also opens the default book1. If I only open excel and close book1 and then open a spreadsheet there is no issue. So why is excel wanting to open the default book when opening an already created excel doc and second, how can I disable or resolve this issue to not open the book1 when opening a spreadsheet but still have it open book1 when I simply open excel only? Thanks in advance, Newtek Do you have a file called Book1.XLS in your XLSTART folder? Excel opens all files in that locale. Or use Tools|options, open General; is there a...

IE 8 Won't open New Window or New Tabs in Server 2008 R2
The Situation: IE 8 won't open links in a new window or a new tab either through javascript or manually using the context menus. Page > New Window still works. Clicking the new tab interface button still works. A new process is opened for the new tab but it fails at 'connecting...' This is on a domain connected development workstation running Server 2008 R2 64-Bit. Accelerators turned off, ScreenFilter turned on. VB.NET 2010 Beta installed. Recent work on a project that involves the WebBrowser control. Java is 6.17. Forefront Client Security is installed. All upd...

how do I get a custom message box to open?
I have a form/subform where I need to have the event and date entered on the main form before information can be entered into the subform. How do I get a custom message box to pop up instead of the generic "You must enter a value in the ... field" when the event and date have not been entered? I think that the order I want to do things in is the following. Help with the actual VBA would be very much appreciated. - What event to use? - check to see if AtEventID is null - do I need this step? Because both the date and event fields are required, Access automatica...

opening files in word
my friend does not have publisher on his computer but wants to print out a publisher file from me i gave him on floppy is they a way to open it in word? Hi paul (paul@discussions.microsoft.com), in the newsgroups you posted: || my friend does not have publisher on his computer but wants to print || out a publisher file from me i gave him on floppy is they a way to || open it in word? No. Word can only retrieve text from the Publisher file, and even then the formatting will be hosed. Send it to him in PDF format. Free PDF app at www.primopdf.com -- Brian Kvalheim Microsoft Publisher MVP...

Do exchange servers store routing paths?
I'm trying to figure out why an exchange server might possibly have delays between two exchange servers. No other e-mail seems to be delayed at either end, just communication between these two servers. Everyone on Server A can send and receive e-mails to eachother and external clients on a timely basis. Everyone one on Server B can send and receive e-mails to eachother and external clients on a timely basis. For some reason there is often a delay that can last 12 hours however when Server A tries to communicate with Server B. All of a sudden a bunch of e-mails between Server...

opening multiple workbooks, opens in seperate program...
hi, when i open more than 1 woorkbook at the same time, it opens a secon icon at the bottom of my windows taskbar. but when i go to close one of the MSexcel programs it also wants t close the second one aswell.... previosly when i open multiple excel workbooks, it only showed on excel program as being open on the taskbar... can anyone give some insight into this? thanks : -- Message posted from http://www.ExcelForum.com p.s i am using excell 200 -- Message posted from http://www.ExcelForum.com Hi sokevin Tools>Options..View Change the Windows in taskbar option -- Regards R...

Stored procedures not copied while installation #2
Dear All GP - tech people Please have a look and suggest - having Great Plains 8.0 service pack 3 -Sql 2000 created first live company DB - everything goes fine - setup every modules - start using Sales Order processing Invoice - nothing wrong anywhere , but when i go to Invoice Distribution button --> default -> delete / cancle , then recieved this error- Unhandled script exception: [Microsoft][ODBC SQL Server Driver][SQL Server]Could not find stored procedure 'TSTGT.dbo.SVC_Delete_SOP_Inv_Dist'. EXCEPTION_CLASS_SCRIPT_MISSING SCRIPT_CMD_CALLSERVER I have checkd...

Check Store Config
I'm trying to config the Check Store function which is available through SO Admin Config - HQ Client settings. Do I enter the HQ Server's IP or the store's HQ Client's IP? Thanks Enter the IP address of the store machine hosting the HQ Client application. "Gary" wrote: > I'm trying to config the Check Store function which is available through SO > Admin Config - HQ Client settings. Do I enter the HQ Server's IP or the > store's HQ Client's IP? > > Thanks I have entered the IP of the machine hosting the HQ Client, but when I g...