Some days

One of the nice things about working out of my home office is two-fold: 
– when I need a break, I can walk through my gardens and relax the mind
– just stand outside and enjoy the sunset.
– go from writing software to practicing acupuncture medicine
Looks like I will miss the big Oralando conference…Rats..  I am sure the Sarasota users group will have a lot to say on the subject.
I have been having some fun stepping back into the past with the vb6 stuff.  ADO handling and the Data environment. 
I found it difficult to use the data wizard as the default driver is set for Access ’97, and I am using the latest Access 2003.  So, the use of the Wizard was out of the question. But creating the Data Environment manual is not that difficult just make sure that you select the proper Microsoft Jet 4.0 and not the 3.5 engine.  From their, I found it much easier to create the database directly in Access 2003 environment.  Test the stored procedures and triggers prior to connecting the database to the vb6 data environment.
For calling a stored procedure that needs a variable to be passed, make sure your procedure looks like the following:
SELECT Client.ClientLogIn
FROM Client
WHERE Client.ClientLogIn=[@ClientLogIn] And Client.ClientPassword=[@ClientPassword];
Note the use of ‘@’ and not just a [?], vb6 tie in likes to have the variable name with an @predecessor.  Now for evoking the SP
In this case, the Data Environment has been named datClient.
Private Function ValidateUser(ByVal strLogIn As String, ByVal strPassword) As Boolean
    datClient.VerifyClientLogin strLogIn, strPassword
    If datClient.rsVerifyClientLogin.RecordCount = 0 Then        ‘ If a record is returned, we found the Client
        ValidateUser = False                                                         
        ValidateUser = True
    End If
    datClient.rsVerifyClientLogin.Close                                          ‘ Make sure to close this session.
End Function
Pretty easy to use don’t you think?  It is certainly much better then having to describe the connection just to gain access to the table.   Like the documentation states, for every query the data is returned with an ‘rs’ prefexed to the name of the query iself (this includes queries, and stored procedures).  (That particular point was not really clarified enough for me)
Until next time..
This entry was posted in Computers and Internet. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s