Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Returning Info From A SQL Proc
Message
General information
Forum:
ASP.NET
Category:
Databases
Miscellaneous
Thread ID:
01258316
Message ID:
01258544
Views:
14
When using the .Fill you do not have to open the connection before calling Fill. The Fill method opens the connection for you and closes the connection afterwards (if the connection is open before the Fill the connection will be left open).

Einar

>I have a SQL proc that accepts two params and returns a record and which also has an
>output parameter with an error state.
>
>Using C#, I need to return the record and the output parameter.
>
>So far, I have the following, but I'm not sure I'm going the right direction. Can anyone help?
>
>
>
>
>// Create and open a connection
>SqlConnection oConnection = new SqlConnection(oDBInfo.sConnString);
>oConnection.Open();
>
>// Set up a data adapter
>SqlDataAdapter oDataAdapter = new SqlDataAdapter("sp_MyProc", oConnection);
>oDataAdapter.SelectCommand.CommandType = CommandType.StoredProcedure;
>
>
>// Create a data set
>DataSet oDataSet = new DataSet("MyTable");
>
>// Fill the data set
>oDataAdapter.Fill(oDataSet);
>
Semper ubi sub ubi.
Previous
Reply
Map
View

Click here to load this message in the networking platform