Saving a dataset back to source

K

Karl

Hi,

I am having trouble trying to save my updated dataset back
to the source db.

The dataset has 6 tables that I need to cache and work
with and then use stored procedures to insert back into
the db.

below is my command object set up, please tell me if this
is wrong:
public SqlCommand GetInsertCommand(string storedProcName,
SqlConnection conn )
{
SqlCommand aCommand = new
SqlCommand (storedProcName, conn ) ;

aCommand.CommandText =
storedProcName;
aCommand.CommandType =
CommandType.StoredProcedure ;
aCommand.Parameters.Add (new
SqlParameter ("@prm1" , SqlDbType.Decimal, 50, "prm1" ) ) ;
aCommand.Parameters.Add (new
SqlParameter ("@prm2" , SqlDbType.Decimal, 50, "prm2" ) ) ;
aCommand.UpdatedRowSource =
UpdateRowSource.OutputParameters ;
return aCommand ;
}
 
M

Miha Markic

Hi Karl,

To check the command you might do the following:
At design time, drag & drop the stored procedure from Server Explorer window
on the form.
The form designer will then generate appropriate code for you.
In this way you can compare it with your version.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top