DataSet insert method returns int in one case and object in another - why?

A

Alan Silver

Hello,

I am using DataSets to insert data into a database. I have one that has
an insert method whose SQL looks something like...

insert into mytable (f1, f2) values (@f1, @f2);
select SCOPE_IDENTITY();

I call this from the code like this...

mytableTableAdapters.mytableTableAdapter mytableAdapter = new
mytableTableAdapters.mytableTableAdapter();
string newid = mytableAdapter.InsertStuff("fvalue1", "fvalue2");

and this works fine. The newid variable gets the latest identity ID from
the table.

I have another DataSet, set up in exactly the same way, that returns an
object. Try as I might, I cannot work out why it insists on returning an
object instead of a string (or other scalar). I have compared the two
and they seem to be similar.

Anyone any ideas? TIA
 

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

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,280
Latest member
BGBBrock56

Latest Threads

Top