Confirm if user has already registered VB

Asked

Viewed 47 times

0

I am developing a Visual Basic application, where I insert the records into a sql server database, these records are shown in the form to the user in a datagridview, and I want to confirm whether the registration is already done or not, or if, if the fields the user inserts are already in the datagridview, especially the id field and my primary key!

I await your reply! Greetings

  • IS Visual Basic or Visual Basic.NET? Keep in mind that the two are very different languages. How do you speak of datagrid, probably referring to VB.NET. By the way, you need to specify your problem better, the way your question is can be considered as not clear enough and will probably be closed. By clicking [Edit] you can improve your question.

1 answer

0

Vc can encapsulate your method within a Try catch instruction https://msdn.microsoft.com/pt-br/library/fk6t46tz.aspx to know if an error has occurred.

If you have created the ID field as IDENTITY you can use the sql statement to retrieve the code:

SELECT IDENT_CURRENT('TABELA');

Browser other questions tagged

You are not signed in. Login or sign up in order to post.