If I wish to validate whether the user input is a duplicate data in database, how can I code it? Is there any sample code that are available?
I'm using ADO to perform add, delete, update and etc...
Thank you...
Gary
19-09-2006 at 08:44 AM
|
shahidmojid Level: Professor Registered: 09-05-2002 Posts: 85
Re: Redundant Data Verification!!! (Urgent)
You can add code under object lost focus events. If users input is duplicate then through an exception.
like
Private Sub TextBox2_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox2.LostFocus
if bduplicate("write an sql query here") then
msgbox "duplicate data please try again."
textbox2.Focus
End Sub
function bDuplicate(sql as string) as boolean
'below is not command just for your idea.
'open connection
'check for duplicate data by using passed parameter (sql)
'if duplicate data then 'bDuplicate = true else 'bduplicate = false
end function
shahid
21-09-2006 at 06:58 AM
|
Gary Level: Sage Registered: 27-11-2005 Posts: 50
Re: Redundant Data Verification!!! (Urgent)
Thanks sir,
I have better idea on it but may I know what SQL query I should write inside the bduplicate("SQL statement") because Im quite new in using SQL.