NinjaTurtle
12-27-2002, 10:32 AM
dear,
example i have 10 records, between the 10 records there are few duplicate data, b4 insert to database i want it smart enough insert only the distinct records without promt users there are duplicate records....
example:
Userlist= request.Form("Userlist")
arrSelectedUsers = split(Userlist,",")
dim SplitID,w
for w = 0 to ubound(arrSelectedUsers)
SplitID = split(arrSelectedUsers(w),",")
if ubound(SplitID)>=1 then
set rsSave = server.createObject("ADODB.Recordset")
rsSave.Open "Select * From User", objSaveconn, adOpenKeyset, adLockPessimistic, adCmdText
rsSave.Addnew
rsSave(UserID") =trim(SplitID(0))
rsSave(UserAge") =trim(SplitID(1)) rsSave.Update
rsSave.Close
end if
Next
Exapmle records i get:
Userlist:
=======
Name | Age
----------------
1. John,19
2. Alex,26
3. Tom,50
4. John,19
5. John,19
6. Mary,21
7. Max,34
8. John,19
9. Alex,26
10. Mary,21
from this databse, u can c there are few user that appear few times in the list: John, Alex & Mary. User name is primary key.
but what i want is i just want to insert the single user for duplicate user in the list so the final insert to data base should be
:
1. John,19
2. Alex,26
3. Tom,50
4. Mary,21
5. Max,34
Possible without Javascript or vbscript to do checking on that??
if using loop to check, how about if my users are >100 users???
example i have 10 records, between the 10 records there are few duplicate data, b4 insert to database i want it smart enough insert only the distinct records without promt users there are duplicate records....
example:
Userlist= request.Form("Userlist")
arrSelectedUsers = split(Userlist,",")
dim SplitID,w
for w = 0 to ubound(arrSelectedUsers)
SplitID = split(arrSelectedUsers(w),",")
if ubound(SplitID)>=1 then
set rsSave = server.createObject("ADODB.Recordset")
rsSave.Open "Select * From User", objSaveconn, adOpenKeyset, adLockPessimistic, adCmdText
rsSave.Addnew
rsSave(UserID") =trim(SplitID(0))
rsSave(UserAge") =trim(SplitID(1)) rsSave.Update
rsSave.Close
end if
Next
Exapmle records i get:
Userlist:
=======
Name | Age
----------------
1. John,19
2. Alex,26
3. Tom,50
4. John,19
5. John,19
6. Mary,21
7. Max,34
8. John,19
9. Alex,26
10. Mary,21
from this databse, u can c there are few user that appear few times in the list: John, Alex & Mary. User name is primary key.
but what i want is i just want to insert the single user for duplicate user in the list so the final insert to data base should be
:
1. John,19
2. Alex,26
3. Tom,50
4. Mary,21
5. Max,34
Possible without Javascript or vbscript to do checking on that??
if using loop to check, how about if my users are >100 users???