Call stored procedure in mfc

Hi guys,

does anyone know how to call stored procedure in MFC using ODBC
connection?  Please help me step by step, because i am kind of new to
this.  Thanks for your help.

Krish

0
1/4/2005 4:11:27 AM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
968 Views

Similar Articles

[PageSpeed] 46

Executing Stroed Procedure is no different than executing any SQL
statement. Some ODBC drivers like to have SP parameters passed in a
certain way. Look at Codeguru/Codeproject for samples for MFC/ODBC.
MSDN also has samples of MFC database classes.  Following is the link
to database section of Codeguru:

http://www.codeguru.com/Cpp/data/mfc_database/

-------------------
Ajay Kalra
ajaykalra@yahoo.com


krish_jasmin@yahoo.ca wrote:
> Hi guys,
>
> does anyone know how to call stored procedure in MFC using ODBC
> connection?  Please help me step by step, because i am kind of new to
> this.  Thanks for your help.
> 
> Krish

0
ajaykalra (6842)
1/4/2005 1:58:46 PM
Reply:

Similar Artilces:

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. Remove the apos...

Recovering Private information store
I had a problem with the Private information store and restored an earlier version from a hard drive backup. I did all the procedures necessary to restore and enable the information store and all my Exchange 5.5 services are started without any error. The problem however is that I am not getting any mail to my users. I run a POP3 connector and I use the viewer to check the POP3 activities. I see the the connection to the mail server and the acknowledgements that it is retrieving E-Mail messages. I cannot figure out where the messages are going on aour server and why are they not bei...

CRT, VCRT, MFC merge modules not updated with VS2003 SP1.
Merge modules are not updated by the VS2003SP1 installer. Where can I get new msm files with updated components?-- Thanks, Stefan Hi Stefan, I have checked those msm files after applying the VS2003 SP1, their contained DLL files have already been updated to the 7.10.6030.0 version ones. If this is not the case in your machine, I suggest you run that VS2003 SP1package under the admin account. Thanks! Best regards, Gary Chang Microsoft Online Community Support ================================================== Get notification to my posts through email? Please refer to http://msdn.m...

controling excel from vba access and using sub procedures
Hi All, I'm having trouble getting my code to work using sub procedures in my vba code, this only happens when i am interacting with excel. I've tried to copy all the dims and defs from the calling procedure but to no avail at this time. sample code below. Dim strPath As String Dim rst As DAO.Recordset Dim Excel_Application As Excel.Application Dim Excel_Workbook As Excel.Workbook Dim Current_Worksheet As Excel.Worksheet Dim Data_Range Dim Worksheet_Name Dim db As Database Dim rs As Recordset D_now = Format(Date, "dd-mm-yy") ' Formated to use as part of fi...

How to create a "really" transparence MFC control?
I wrote a D3D app based on the MFC dialog,the app's draw frequency is 30FPS.It has a main dialog,i create the D3D device on it,also i create some sub dialogs and controls on this main dialog.When i run this app, some errors appear.When i click or move the sub dialogs and controls it reflash on the background(I think the MFC's draw frequency unequal to the D3D app's draw frequency cause this problem), this bring on the bad effect.Is there any methods let this sub dialogs and controls didn't reflash or redraw themself to be "really" transparence:only receive or send...

VISTA & MFC icon
Hi I am showing icons in a List control . It works ok in XP,2000, and 98 But when I run application in Vista the icons are displayed as black square(16 X 16 ) Please can you tell me is their any format difference in the Vista and other OS for Icons. Or can you please let me know what should be done to correct this error. Thanks Anup I have several programs that use icons in list controls. Perhaps you could show some of the code where you create the image list? Maybe your image list is going out of scope and it just happens to work on XP? Tom "Matrixinline" <anup.katari...

Suggestions On Storing External Data
Hello, I was wondering what the best way to store, Word, Excel, pdf,and dwg documents against a Record in my database. My Database is a Enquiry Management Database, and when projects come in they are logged, which when an enquiry is received they have associated documents with them. So what the plan is that the User who inputs projects can select the assign the associated to the record, and then when some else looks up the project that can see all related documents and also open them from my database. 1. Do i Store External Documents in the database or 2, Do I Link to the documents, I w...

MFC explicit call to RegisterClassW
I'm trying to build the MFC library with a change: all calls to RegisterClass* become RegisterClass*W so that the apps that use this library will answer "true" to the IsWindowUnicode call (even though I'm building these apps *without* the _UNICODE flag--don't ask why I'm not wanting to set that compiler define; I'm constrained against setting it and making this a true Unicode app). Anyway, according to the help, if you register a window class using the *W function, then those windows should answer "true" to the IsWindowUnicode message and therefo...

Modify Store ID
I want to change the Store Id. I have changed it throurg database (Store Table) in HQ and Store both side but after changing it stops communicating with HQ. Some having any idea? Thanks Check Configuration Table at Store. Ivan "NAVEED" <NAVEED@discussions.microsoft.com> wrote in message news:C81FDAAE-25CD-49DB-A945-17FDC8D9F906@microsoft.com... >I want to change the Store Id. > I have changed it throurg database (Store Table) in HQ and Store both side > but after changing it stops communicating with HQ. > > Some having any idea? > > Thanks If yo...

For Next issue with repeated procedure
I have the procedure below. Basically I don't want to have interminable lines of code when all I am doing is repeating the same procedure on a differnet range. How can I write the procedure that it loops through the procedure with the 6 different ranges rng1 = "A1:A9" rng2 = "A11:A20" Rng3 = "A30:A34" Rng4 = "A40:A48" Rng5 = "A50:A59" Rng6 = "A65:A69" n = 6 For i = 1 To n ActiveCell.Range(rng(i)).Select Selection.Copy Selection.PasteSpecial Paste:=xlPasteValues Applicati...

What is the step-by-step procedure for making a data list?
I've read and re-read how to do datalists, but I cannot get the hang of how to make one and apply it. I need a simple tutorial in how to make one, from A to Z. I want to call in items that have cost associated with them instead of typing them each and every time. Any GOOD help will be greatly appreciated. Try Debra's nice coverage on VLOOKUP at her: http://www.contextures.com/xlFunctions02.html -- Rgds Max xl 97 --- GMT+8, 1� 22' N 103� 45' E xdemechanik <at>yahoo<dot>com ---- "Bobgolfs56" <Bobgolfs56@discussions.microsoft.com> wrote in me...

Problem with COleDateTime in MFC 8
I have the following problem with COleDateTime COleDateTime dt; if(dt.ParseDateTime(dateStr, LOCALE_NOUSEROVERRIDE | VAR_DATEVALUEONLY)) { strDate = dt.Format("date%Y%m%d month%m%Y"); } if dateStr is before 1900 it crashes in the Format call. I know this is a known issue but the articles on the MS website are clear as mud as to whether it has been fixed? Whether it is in Service Pack 1? Whether there is a HotFix for it? Anyone have any ideas? Internally, the implementation of Format uses the _tcsftime (strftime or wcsftime) function, which relies on the age-old struct ...

Using Alt-key in MFC app
I am creating a cad-program which must simulate the user interface of another program. This means that I need to be able to use Alt-key combinations, like alt-leftmouse and mousemove and such. Default key handling forces the alt key to be used with menu only. Is there a way to work around this safely? Yours, Morten Aune Lyrstad Never mind; got it! Just needed to find GetAsyncKeyState(VK_MENU)! Use GetKeyState instead. "Morten Aune Lyrstad" <too@much.spam> wrote in message news:fBgHc.13$Rb.7643@juliett.dax.net... > Never mind; got it! Just needed to find GetAsyncKeySt...

How to set custom class name for MFC frame window?
When you create a frame window in MFC using following code: BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CMDIFrameWnd::PreCreateWindow(cs) ) return FALSE; // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs cs.lpszClass = AfxRegisterWndClass(0); return TRUE; } In Spy++, the default frame name is Afx:00400000:0. How can I set custom name instead of the default name? Thanks. Michael On Wed, 16 Nov 2005 14:49:47 -0800, "Michael" <Michael@discussions.microsoft.com> wrote: >When you create a frame window in MFC usi...

Please help!!! Information Store and System Attendant does not start
Hello Everyone, I have a couple of questions. Friday my exchange 2k box crashed on the windows side. I have put the exchange hard drives in a new pc. I repaired the drive by running the windows repair and bascially had to almost install windows again. However, it comes back up at win2k sp3. I reran the exchange sp3 patch on the server. All my drives look good. However, the information store and exchange system attendant will not start. I was wondering if anyone can give me advice on why this is happening? Also on a side note I can not remote desktop into this pc which is weird? I can ping...

Service Call Dispatch sort options
The service call dispatch board needs some additional sort options. For example call priority and call number. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/Businesssolutions/Community/NewsGroups/dgbrowser/en-us/default.mspx?mid=567f0968-f08...

Deployment of MFC/COM IE Toolbar
Hi Everyone, A newbie here. I'm having problems deploying my toolbar that I created in VS6 VC++ which is based upon MS's KBBar sample. I hope someone here could point out my mistakes. The toolbar works fine on my PC. VS6 registers the components and when I start IE, I see my toolbar under View->Toolbars. I select it and my toolbar appears and I'm able to click my buttons and the correct callbacks occur. I then made a Win32ReleaseMinSize Release and in my output "ReleaseMinSize" directory, files generated are: 13/03/2006 03:10 PM 45,056 CVToolbarInstall.d...

Simple question about DAO upgrade for an MFC application
I support a large application with over a dozen Microsoft Access "MDB" files. These files were created with and are compatible with Office 97 only. I.E., the files can be viewed, but not edited, with the newer versions of Office, which is no surprise. My question is probably an easy one for you gurus "How do upgrade my app to use MDB files created with a newer version of Office - such as Office XP?" Is it just a matter of converting the MDB files and possibly refreshing the DAO classes in my app? Or is their more involved? Finally are there any unforeseeables such as if...

explicit call to ~CMDIChildWnd
In VS 2005, what is the reason an explicit call to ~CMDIChildWnd in the destructor of a derived class causes _CrtIsValidHeapPointer assertion? On Tue, 26 Jun 2007 21:46:09 GMT, "VCPP" <no_vcpp_spam@sbcglobal.net> wrote: >In VS 2005, what is the reason an explicit call to ~CMDIChildWnd >in the destructor of a derived class causes _CrtIsValidHeapPointer assertion? When you call a base class dtor in that context you end up double-destructing the object. You must not do this, because the compiler arranges for all dtors to be called in the reverse order of construction....

Generic class for data acces from an MFC application?
Hello experts, I do not want to reinvent the will. I need read/write to an MSDE sql server from my mfc application . I thought someone has probably written a class that can be used and that does most of the things including executing stored procedures. I only have experience with ado.net but i need to maintain this VC++6 application where dotnet is not accesible. Any input will be appreciated. Best wishes JB Hello Bredal! On Tue, 5 Oct 2004 13:03:12 +0200, Bredal Jensen wrote: > I do not want to reinvent the will. I need read/write to an MSDE sql server > from my mfc applicati...

Getting calling Exe's name
I expected System.Reflection.Assembly.GetCallingAssembly().GetName().Name; to give me the name of the exe calling a c# class library. It isn't - the c# class library is a COM interrop dll and the calling exe is a Win32 Exe. What am I doing wrong, any ideas? Hello, Likely because a win32 exe file is not an assembly... Perhaps by getting the current process ? -- Patrice "AA2e72E" <AA2e72E@discussions.microsoft.com> a écrit dans le message de news:D88666E4-9E8B-404B-8930-AFA3B050B0C0@microsoft.com... >I expected > > System.Reflection...

Is there an exchange store mode that is accelerated for mailbox loading?
Hi, I recall seeing a way somewhere but can't find it now to put the store in a mode where you can load mailboxes faster using import-mailbox. I am using exchange 2007/sbs 2008. Thanks, Alan ...

Phone Call searching
Users want to search phone calls according Sender value. I switched Sender attribute to be searchable (disabled by default). But when trying to search the "Invalid Argument" exception occurs. Is there something else to be done? Thanks for answers. Petr K. If the Sender is also the person who created the Phone Call, then I would search on that instead. The issue may be associated with the field schema of Partylist, but I could be wrong. We experience a similiar issue when we try to search on that field type on other entities. Best Regards "PetrK" wrote: > User...

How to move [quickly] from ISAM to SQL Express/MFC?
Hi, I realise that this is a rather vague question and not that easy to answer. Still, I hope that someone else reading this group had to do something similar in the past. Although database access has been part of almost every project I've worked on over the years, it was a rather minor part. In most of the cases a single user access through proprietary ISAMs, embedded SQL, or JDBC. For example, I've been using DB2 and embedded SQL on Win32 simply because DB2 used to be cheap and reliable (also the only DBMS on OS/2 many years ago that I developed on). I'm now about to...

Create item at store level then push to HQ ...
We were told my a vendor that it is possible to create an item at the store level, then push it up to HQ rather than the other way around. Someone else asked the same question earlier, but the only reply was from someone who had created a utility to handle it. Is it true there is a way to do it inside RMS? Thanks, Dave Burgon No, that's not true. If you MANUALLY recreate the item at HQ with the same Item Lookup Code, then add it to a 250 worksheet for the store, the items will be syncronized. There is no facility built into RMS to Push an item from a Store to HQ - you would n...