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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating multiple records with passwords

Status
Not open for further replies.

s4dadmin

Programmer
Apr 27, 2003
107
0
0
US
I have added a password field to my members database. I want to add a unique password to each member in the table. The code I have created does not update all the fields, it seems to only loop around the first record and constantly update it with new passwords. It is somehow stuck in that loop. Can anyone help? Here is the code

Code:
<%
Dim fs, i, x
Dim strTemp
Dim rsMember
Dim rsSelect
Dim sql2
Dim intID
Dim strSQL

sql2 = "Select memberID From tbl_Members;"
Set rsSelect = Server.CreateObject("ADODB.Recordset")
rsSelect.Open sql2, adoCon

Set fs = CreateObject("Scripting.FileSystemObject")
Set rsMember = Server.CreateObject("ADODB.Recordset")

Do Until rsSelect.EOF
intID = rsSelect("memberID")
  'Get just the filename part of the temp name path
  strTemp = fs.GetBaseName(fs.GetTempName)

  'Hack off the 'rad'
  strTemp = Right(strTemp, Len(strTemp) - 3)

strSQL = "Select tbl_Members.* FROM tbl_Members Where memberID ="& intID
rsMember.CursorType = 2
rsMember.LockType = 3
rsMember.Open strSQL, adoCon

rsMember.Fields("memberPassword") = strTemp
rsMember.Update
rsMember.Close
  Response.Write strTemp & "<br>"
Loop

Set fs = Nothing
Set rsMember = Nothing
rsSelect.Close
Set rsSelect = Nothing

%>
 
This should have been in the VB forum, not SQL.

That said, you don't have a rsSelect.movenext anywhere.
It should be the list directly before the Loop statement.

Denny

--Anything is possible. All it takes is a little research. (Me)
 
no problem :)

Denny

--Anything is possible. All it takes is a little research. (Me)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top