Thread: Error messages
View Single Post
  #10 (permalink)  
Old June 5th, 2005, 12:40 PM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

To see if the user already has an account, try something like this:

strSQL = "SELECT tblStyleSheet.UserName, tblStyleSheet.UserStyle FROM tblStyleSheet WHERE UserName = '" & strUserName & "'";"
        rsEA.CursorType = 2
        rsEA.LockType = 3
        rsEA.Open strSQL, objConn
If rsEA.EOF Then ' EOF means End of File which means empty recordset

        objConn.Execute "INSERT INTO [tblStyleSheet]" & " ([UserName], [UserStyle])" & " VALUES('" & strUserName & "','" & "blue" & "');"

Else
 theStyleSheet = rsEA.Fields("UserStyle").Value

You could save the style sheet in a session variable so it's available to all pages. That way you don't have to hit the database each time.

Dim styleSheet
If Session("StyleSheet") = "" Then
  ' Get the style sheet from the database
Else
  styleSheet = Session("StyleSheet")
End If

Does this help?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.