Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

What is the proper way of getting back the autoincrement value for a column in a datatable (part of a strongtyped dataset) that I have just added a row to? I'm currently doing it by this method - after the row is created..

 

Dim row As adataset.mytablerow = CType(mytable.Rows(mytable.Count - 1), adataset.mytablerow)

 

I really don't like this approach - is there any better way?

Posted

I'm not sure what code you are using to add your row...but this may be a little simpler than what you have...kind of all ends up being the same. Either type it all out in 1 code string, or break it up a little...

 

Dim i as Integer
With ds.Tables("YourTableName")
   i = .rows(.rows.count - 1).Item("yourcolumnName")
End With

"In the immortal words of Socrates, who said "' I drank what?!'"

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...