Results 1 to 3 of 3

Thread: look at this

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2002
    Posts
    36

    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

  2. #2
    Frenzied Member axion_sa's Avatar
    Join Date
    Jan 2002
    Location
    Joburg, RSA
    Posts
    1,724
    i don't know s**t bout oracle, so i'll use sql server

    VB Code:
    1. Private Sub Command1_Click()
    2.   Dim rsaCheckExist As ADODB.Recordset
    3.   Dim strSQL As String
    4.  
    5.   strSQL = "SELECT * FROM Passwords WHERE UserName = '" & Trim(txtUserName.Text) & "'"
    6.    Set rsaCheckExist = New ADODB.Recordset
    7.    rsaCheckExist.Open strSQL, [db connection]
    8.    
    9.    If Not (rsaCheckExist.EOF) = True Then
    10.       'the record exists
    11.    Else
    12.       'the record dont exist
    13.    End If
    14.  
    15.    'Recordset cleanup
    16.    If rsaCheckExist.State <> adStateClosed Then rsaCheckExist.Close
    17.    Set rsaCheckExist = Nothing
    18. End Sub

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    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
  •  



Click Here to Expand Forum to Full Width