Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Need VB & SQL help.

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Random spam
View previous topic :: View next topic  
Author Message
C-Dizzle
Grandmaster Cheater
Reputation: 89

Joined: 16 Mar 2008
Posts: 623

PostPosted: Sat Feb 25, 2012 11:38 am    Post subject: Need VB & SQL help. Reply with quote

My project works fine in college and used to work fine at home but I keep getting the error 'Invalid use of Null'. This is for a log on page using SQL and VB.

Here is the code. I know it's probably pretty shit but it's what the teacher taught us.
Code:
Option Explicit

Private Sub cmdLogon_Click()
On Error GoTo ErrorTrap
 'Connect to database

DBConnection

    strSQL = "SELECT * FROM tblUsers "
    strSQL = strSQL & "WHERE UserName = '" & txtUserName.Text & "' "
    strSQL = strSQL & "AND UserPass = '" & txtUserPass.Text & "'"
    objADOCon.Execute strSQL
   
    'call the public sub in modDatabase (open a recordset)
    OpenRecordset
   
    'Populates variables with returned records
    With objADORs
        'keep going until you reach .EOF (end of file)
        If Not .EOF Then
            strUser = !UserName
            strPass = !UserPass
            intUserLevel = !UserPermission
        End If
    End With
   
    'check if both username and password do not match
    If Not txtUserName.Text = strUser And Not txtUserPass.Text = strPass Then
        'username/password not found
        'show a messagebox
        If MsgBox("Access Denied.  Login Credentials Mismatch.", vbCritical, "Mismatch") = vbOK Then
            ResetScreen Me
            'go no further
            Exit Sub
        End If
    ElseIf txtUserName.Text = vbNullString And Not txtUserPass.Text = vbNullString Then
        'username not provided
        If MsgBox("Access Denied.  You must supply a username.", vbCritical, "Username Input Required") = vbOK Then
            txtUserName.SetFocus
        End If
        Exit Sub
    ElseIf txtUserPass.Text = vbNullString And Not txtUserName.Text = vbNullString Then
        'password not provided
        If MsgBox("Access Denied.  You must supply a password.", vbCritical, "Password Input Required") = vbOK Then
            txtUserPass.SetFocus
        End If
        Exit Sub
    ElseIf txtUserPass.Text = vbNullString And txtUserName.Text = vbNullString Then
        'username and password not provided
        If MsgBox("Access Denied.  You must supply a username and password.", vbCritical, "No Login Provided") = vbOK Then
            txtUserName.SetFocus
        End If
       

    Else 'got a match
    'Stores UserID
    intUserID = objADORs!UserID
    'Stores UserName
    strCurrentUser = objADORs!FirstName
    'Stores Users points
    intUserPoints = objADORs!UserPoints
   
        'Display a mesage box to show that access is ok
        MsgBox "You have successfully logged on. Your user level is: " & intUserLevel
    End If
   
    'Hides this form
    Me.Hide
    'Shows the main splash
    frmMainSplash.Show
   
Exit Sub
ErrorTrap:
    MsgBox "There has been an error. The error number is: " & Err.Number _
            & " and the error description is: " & Err.Description
           
End Sub
Back to top
View user's profile Send private message
Cryoma
Member of the Year
Reputation: 198

Joined: 14 Jan 2009
Posts: 1819

PostPosted: Sat Feb 25, 2012 1:29 pm    Post subject: Reply with quote

That's supposed to be php?
Back to top
View user's profile Send private message
C-Dizzle
Grandmaster Cheater
Reputation: 89

Joined: 16 Mar 2008
Posts: 623

PostPosted: Sat Feb 25, 2012 2:06 pm    Post subject: Reply with quote

Cryoma wrote:
That's supposed to be php?


No. For my college computing class we need to make a program for a school points scenario. It's Visual basic and SQL <So I can use a database for accounts and what not>
Back to top
View user's profile Send private message
Channel GannoK
pffrt
Reputation: 130

Joined: 12 Apr 2008
Posts: 608

PostPosted: Sat Feb 25, 2012 2:12 pm    Post subject: Reply with quote

what IDE are you using. Express or pro?
_________________
Back to top
View user's profile Send private message
C-Dizzle
Grandmaster Cheater
Reputation: 89

Joined: 16 Mar 2008
Posts: 623

PostPosted: Sat Feb 25, 2012 2:20 pm    Post subject: Reply with quote

GannoK wrote:
what IDE are you using. Express or pro?


Microsoft Visual Basic 6.0.
Back to top
View user's profile Send private message
Cryoma
Member of the Year
Reputation: 198

Joined: 14 Jan 2009
Posts: 1819

PostPosted: Sat Feb 25, 2012 2:23 pm    Post subject: Reply with quote

Oh I thought you meant vbulletin, good luck with that.
Back to top
View user's profile Send private message
TheIndianGuy
Advanced Cheater
Reputation: 102

Joined: 14 Jan 2007
Posts: 85

PostPosted: Sat Feb 25, 2012 2:30 pm    Post subject: Reply with quote

Arktri wrote:
GannoK wrote:
what IDE are you using. Express or pro?


Microsoft Visual Basic 6.0.


oh man what
Back to top
View user's profile Send private message
C-Dizzle
Grandmaster Cheater
Reputation: 89

Joined: 16 Mar 2008
Posts: 623

PostPosted: Sat Feb 25, 2012 2:31 pm    Post subject: Reply with quote

TheIndianGuy wrote:
Arktri wrote:
GannoK wrote:
what IDE are you using. Express or pro?


Microsoft Visual Basic 6.0.


oh man what


Google failed me. I don't know what IDE is is.
Back to top
View user's profile Send private message
Cryoma
Member of the Year
Reputation: 198

Joined: 14 Jan 2009
Posts: 1819

PostPosted: Sat Feb 25, 2012 2:53 pm    Post subject: Reply with quote

Arktri wrote:
TheIndianGuy wrote:
Arktri wrote:
GannoK wrote:
what IDE are you using. Express or pro?


Microsoft Visual Basic 6.0.


oh man what


Google failed me. I don't know what IDE is is.

If you're using VB6 then it's self explanatory so don't sweat it.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Random spam All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites