Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

session state objext , need help urgent, driving me crazy

Status
Not open for further replies.

StylizIT

Programmer
Dec 4, 2003
62
NL
hi people, I've been at all day tryingto solve my damn multi user problem in my asp.net application.

here's what I came up with, but it's giving me problems when a 2nd user tries to connect to the application.

- I've stored almost al variables into the users session
- I've stored 2 array's into the users session

The problem I was getting before I did this was that the following code wasn't working correct for the 2nd user.

===========================================================

Public Function fillddl() As String

Try

Odbccommnd.CommandText = Session.Item("query")
Dim myreader As Odbc.OdbcDataReader = Odbccommnd.ExecuteReader()

Session.Item("teller1") = 1
Session.Item("teller2") = 0

If myreader.HasRows Then


While myreader.Read
Session.Item("teller2") = Session.Item("teller2") + 1
End While
myreader.Close()

ReDim Session.Item("fillwaarde")(Session.Item("teller2"))
Session.Item("fillwaarde")(0) = "_Kies_"


Dim myreader2 As Odbc.OdbcDataReader = Odbccommnd.ExecuteReader()
While myreader2.Read
Session.Item("fillwaarde")(Session.Item("teller1")) = myreader2.GetString(0)
Session.Item("teller1") = Session.Item("teller1") + 1
End While
myreader2.Close()

Else
ReDim Session.Item("fillwaarde")(1)
Session.Item("fillwaarde")(0) = "_Geen waardes_"
myreader.Close()
End If
Catch ex As Exception
log(ex.Message)
End Try

End Function

===========================================================

This function is called everytime a user request one of my forms. It will read de requested data from the database.

The problems was that for user1 everything worked perfectly. But when user2 tries to access one of the forms
which also uses this function, the data that's being retreived from the databse wasn't correct anymore.

So I thought I'll use everything in a session. so that every user will have his own variables and arrays. But after doing so I now get the following error for user2 when he tries to access a page that uses this function while user 1 is also doing so.

Object variable or with block variable not set

It's driving me crazy cause it's working perfectly for the first user that logs in. And its supossed to work for the second user the same way. I don't what I'm doing wrong here.

thanks in advance.

You can better regret that you have done something than regret the fact you done nothing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top