Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to exec a C#. Net Windows app calling a Sybase Stored Proc ? 1

Status
Not open for further replies.

barden9

Programmer
Aug 11, 2009
4
US
Do you know how to execute a Sybase Stored Procedure in a C# .Net Windows forms application from an ODBC connection ?

I am developing a C# .Net Windows forms application using Visual Studio 2005.
I need to call Sybase Stored Procedures from my application.
I use a Sybase ODBC connection as follows:

User Data Sources
------------------------
Name NYP Driver DataDirect 4.0 Sybase WIre Protocol

I have created the following code so far:

OdbcConnection _conn2 = new System.Data.Odbc.OdbcConnection("DSN=NYP;UID=PW;PWD=Tl;");
_conn2.Open();
 
I would assume it looks something like this
Code:
var cmd = _conn2.CreateCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "exec [name of proc]";
var parameter = cmd.CreateParameter();
parameter.Name = "name";
parameter.Value = value;
cmd.Parameters.Add(parameter);
cmd.Execute[Reader/NonQuery/Scalar]();

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top