dataset - Insert-query with stored procedure using wizard

  • Thread starter Jon Haakon Ariansen
  • Start date
J

Jon Haakon Ariansen

Hi all,

I don't know where to publish this question but hope this newsgroup is okey.

I'm working in Visual Studio 2005 and are now creating a dataset file where
I will do all the transactions with the database.

I have a consumer table where I want to insert, update and delete consumers.
In the database I use uniqueidentifier on the primary key and said that it
is a rowGuid - (newid()).

When I try to generate a stored procedure to insert new consumers I have to
insert without adding the primary key because it is automatically generated
on a new insertion. However when using the wizard to generate the stored
procedure the wizard fails when I remove the primary key.
After the insert query the wizard created a select query with a where -
clause like the primary key variable.
(uidConsumerID = @uidConsumerID). Here I changed to SCOPE_IDENTITY( )
instead to get the databaserow from the current scope.
But this fails.

So what's wrong? What is the best way to make an insertion to a row using
RowGuid on the primary key?
Until further I will try to create the sp manually in the database and force
dotnet to use my own stored procedure.

In advance thanks a lot for your help!

Kind regards,

Jon Haakon
 
C

Cor Ligthert [MVP]

Jon,

If you use Outlook Express, than we will be obliged if you don't multipost.

With Crossposting (sending one message to relevant newsgroups) is no problem
in the dotnet Newsgroups.

I have answered your question in another newsgroup.

Thanks in advance.

Cor
 
J

Jon Haakon Ariansen

Hi Cor,

Thanks for quick reply.
I'm sorry that I posted a question on two places. I found "...general"
first.
Then I found "...adonet" and published there afterwards.

To solve my problem I tured off "Is RowGuid" in the database and instead
create
a guid inside the stored procedure. And do a select with this guid to return
a rowset
to get the generated guid.

Thanks for help,

Jon Haakon
 

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