Jump to content

for each statment with RS


Matar

Recommended Posts

hi i use for each statment to get the values of recored in access db so for example if there are a recored contain 6 fields how can i get 4 fields with for each statment

Off the top of my head, I imagine this code would work if you already know the 4 fields you want to use:
'connect to your databaseDim SQL, X, someVarSQL = "Select field1, field2, field3, field4 from Your_Table"Set RS = Server.CreateObject("ADODB.Recordset")RS.open Conn, sql1, 1, 1For each X in RS.Fields     someVar = RS(X)Next

Link to comment
Share on other sites

hi thnak u man for replay but i cant detrmaine which fields i want , because every user have his data the problem i face i store the username and pass and other data when the user login to his account the login page will retreve the username and pass and the other data . i wanna to prevent the login to get the user and pass and show other data by for each statment

Link to comment
Share on other sites

hi thnak u man for replay but i cant detrmaine which fields i want , because every user have his data the problem i face i store the username and pass and other data when the user login to his account the login page will retreve the username and pass and the other data . i wanna to prevent the login to get the user and pass and show other data by for each statment

Not exactly sure what you mean, but what if you just throw in If..End If.If CurrentField = Username Or CurrentField = Password Then  skipElse  do what it should cuz its not username or passEnd if?
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...