C#
Home > Ask the SQL Server Experts > Greg Low - Development Questions & Answers > Best approach for using stored SQL procedures in Visual C++
Ask The SQL Server Expert: Questions & Answers
EMAIL THIS

Best approach for using stored SQL procedures in Visual C++

Greg Low EXPERT RESPONSE FROM: Greg Low

Pose a Question
Other SQL Server Categories
Meet all SQL Server Experts
Become an Expert for this site


Expert advice on database development
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


>
QUESTION POSED ON: 24 December 2005
I want to use stored SQL procedures in visual C++. Specifically, my stored procedure is a query which takes three parameters as input. What is the best approach for making this work?

>
EXPERT RESPONSE
In any language that can use the ADO.NET library, you simply follow these steps:

1. Create a SQLCommand object
2. Set the CommandType to CommandType.StoredProcedure
3. Set the CommandText to the name of the procedure
4. Create 3 x SQLParameter objects, setting their type, name and values
5. Add the SQLParameter objects to the SQLCommand's Parameters collection
6. Call the ExecuteNonQuery method of the SQLCommand object


Sound Off! -   Be the first to post a message to Sound Off!


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


RELATED CONTENT
Greg Low - Development
Copy stored procedure between SQL Server 2005 databases
Should developers have permissions to SQL Server production queue?
Schedule stored procedure and save output to network drive
Query to find SQL Server database names created by users
Problem attaching stored procedure and SQL Server trigger
Is it possible to find disabled indexes in SQL Server 2000?
SQL Server id permission to create and modify tables
Installing different SQL Server versions on one machine
Calling an extended stored procedure in SQL Server 2005
Multiple SQL Server instances vs. multiple databases

C#
Developing CLR database objects: 10 tips, 10 minutes
CLR architecture
CLR assemblies in SQL Server 2005
Creating CLR database objects
User-Defined Functions
User-Defined Types
Debugging CLR database objects
.NET database object security
CLR aggregates
CLR triggers
C# Research

SQL Server stored procedures
Check SQL Server database and log file size with this stored procedure
SQL Server source code analysis and management adds database security
SQL and SQL Server Tutorial and Reference Guide
Configure SQL Server Service Broker for sending stored procedure data
Find size of SQL Server tables and other objects with stored procedure
Track changes to SQL Server 2000 and 2005 with one simple utility
Troubleshoot SQL Server 2005 temporary table performance problems
Use SQL Profiler to find long running stored procedures and commands
Stored procedure to monitor long-running jobs in SQL Server 2000
Using BULK INSERT to insert rows from SQL Server dataset to table

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
C++  (SearchSQLServer.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice

HomeNewsTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersIT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 2005 - 2008, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts