YOU CAN CODE!

 

With The Case Of UCanCode.net  Release The Power OF  Visual C++ !   HomeProducts | PurchaseSupport | Downloads  
Download Evaluation
Pricing & Purchase?
E-XD++Visual C++/ MFC Products
Overview
Features Tour 
Electronic Form Solution
Visualization & HMI Solution
Power system HMI Solution
CAD Drawing and Printing Solution

Bar code labeling Solution
Workflow Solution

Coal industry HMI Solution
Instrumentation Gauge Solution

Report Printing Solution
Graphical modeling Solution
GIS mapping solution

Visio graphics solution
Industrial control SCADA &HMI Solution
BPM business process Solution

Industrial monitoring Solution
Flowchart and diagramming Solution
Organization Diagram Solution

Graphic editor Source Code
UML drawing editor Source Code
Map Diagramming Solution

Architectural Graphic Drawing Solution
Request Evaluation
Purchase
ActiveX COM Products
Overview
Download
Purchase
Technical Support
  General Q & A
Discussion Board
Contact Us

Links

Get Ready to Unleash the Power of UCanCode .NET

 


UCanCode Software focuses on general application software development. We provide complete solution for developers. No matter you want to develop a simple database workflow application, or an large flow/diagram based system, our product will provide a complete solution for you. Our product had been used by hundreds of top companies around the world!

"100% source code provided! Free you from not daring to use components because of unable to master the key technology of components!"


MFC Library Article: Create Database with SQL Server and ADO Stored Procedures

 
 

Introduction

It is a useful tool to minimize your database related code. Just using CDatabaseServer by following some steps, you will find it very useful for your project.

Requirements

  1. Your database retrieval must rely on stored procedures.
  2. SQL Server must be installed on the same machine where this code is running.

Explanation

The reason to write this article is that our database applications have somehow redundant code and may cause problems. For example ADO library, we use it when we have to make a call to database. Usually its our practice that when we need data from database, we open connection every time and get data in RecordSet object every time...

I have tried to implement a class that will fulfill the request of database calls whether incoming or outgoing.

You guys will really enjoy when you use it in your C++ application. I suggest you to follow these steps:

  • For your database project, add provided two files databaserver.h and databaserver.cpp.
  • Whenever you need data, call CDatabaseServer's methods getExecStoredProcedure by putting arguments correctly. That method will return VARIANT array using GetRows method of ADO Recordset so that data can be marshaled properly.
  • Whenever you need to insert/update data, then call CDatabaseServer's method setExecStoredProcedure. That method will return long value which could be ID entity to which operation was performed.
  • Now it's your responsibility to manually update your connection information in the method SetConnectionsting.
  • Create database in SQL Server, modify local variable szDatabase with newly created database name in the setConnectionsting method.
  • When calling getExecStoredProcedure/setExecStoredProcedure, be careful to send proper stored procedure name and and its parameter in SAFEARRAY pointer.
  • Parameter must be in the same sequence as in stored procedure.

Please don’t hesitate to ucancode.net about any kind of problems and also if you guys have some better suggestions, then keep me informed.

 

 

 

 

Copyright ?1998-2024 UCanCode.Net Software , all rights reserved.
Other product and company names herein may be the trademarks of their respective owners.

Please direct your questions or comments to webmaster@ucancode.net