|
-
Mar 4th, 2002, 04:17 AM
#1
Thread Starter
Junior Member
Doubt in storing values in database table
I store the listbox values in the database table using the below coding:
for i= 0 to list1.listcount-1
rs.addnew
rs![fnam]=list1.list(i)
rs.update
next i
The datas are added to the table. But if i run the program second time, the same values are again added to the table. If i run second time, the values which are added to the table(at first running) must be cleared and the values should be added freshly.
How to do this using vbcoding. Please help me.
-
Mar 4th, 2002, 04:27 AM
#2
Fanatic Member
for i= 0 to list1.listcount-1
' Attempt to find the entry.
rs.Find "fnam = '" & list1.list(i) & "'"
' Check if the entry was already found.
If Rs.Eof then
rs.addnew
rs![fnam]=list1.list(i)
rs.update
end if
next i
Leather Face is comin...
MCSD
-
Mar 4th, 2002, 04:34 AM
#3
Bouncy Member
alternativly you could just delete the contents of the table.
since you are going to be going through all of the listitems and searching for each one, you may as well just delete all existing records in the table. should be faster too.
i.e.
connection.Execute "DELETE * FROM tablename;"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|