Data Access Block and Identity Column Return...

M

Mark Essex

I am using the SqlHelper class from the Microsoft Data Application Block and
had a question about returning an Identity Column.

Basically, I have a form with a grid bound to a DataSet. The user can, for
example, Add a new record. When they do this, and press Save, I call the
ExecuteDataSet method. I am using Stored Procedures, and in the procedure,
at the end of the insert, I do the following:

select @id = scope_identity()

@id is set as an OUTPUT parameter on the procedure.

When I check the value of the @id column on the dataset that gets returned,
the value is null.

I am just wondering if I am doing this correctly. I will continue to debug
the code, but thought I would see if anybody else has done this
successfully.

THanks,

Mark
 
M

Mark Essex

Never mind....it was an interface problem between the seat and the keyboard!
I was not setting the Parameter direction correctly on my output parameter,
and it defaults to INPUT, so the value was coming back Null.

Mark
 

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