|
-
Feb 5th, 2002, 08:10 AM
#1
Thread Starter
Member
look at this
I have a Table "password" in Oracle.I created 2 text box in Vb and 2 label box(UserName,Password) and 2 command button(Ok, Cancel).
I want to store that values in Oracle Backend.I created a table "Password" in Oracle and i created a primary key to username.Ok...
But when i click the ok button, it should give a message that "This user already exists.Please type another name".
How it can be done...?
Please this time don't suggest any topic but write code if u know..please
Thanks In advance
-
Feb 5th, 2002, 08:50 AM
#2
i don't know s**t bout oracle, so i'll use sql server 
VB Code:
Private Sub Command1_Click()
Dim rsaCheckExist As ADODB.Recordset
Dim strSQL As String
strSQL = "SELECT * FROM Passwords WHERE UserName = '" & Trim(txtUserName.Text) & "'"
Set rsaCheckExist = New ADODB.Recordset
rsaCheckExist.Open strSQL, [db connection]
If Not (rsaCheckExist.EOF) = True Then
'the record exists
Else
'the record dont exist
End If
'Recordset cleanup
If rsaCheckExist.State <> adStateClosed Then rsaCheckExist.Close
Set rsaCheckExist = Nothing
End Sub
-
Feb 5th, 2002, 09:20 AM
#3
I use both SQL Server and Oracle and axion_sa's routine is what I use to check for the existence of a user id.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|