Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 add values from listbox to table using

Author  Topic 

odeh83
Starting Member

8 Posts

Posted - 2006-04-19 : 03:52:47
Guys, i searched the forum and i found similar threads but non-worked 4 me,

My question is, how can i add the values in listbox1 to table "RPTPARAM" into a field named "SORTBY"! The field is varchar2 (2000) so it can accept many characters!

The loop works fine but I don't know how to insert all the data in listbox1 to the SORTBY field...

here is the code.........

Dim a As Integer
If ListBox1.Items.Count > 0 Then
For a = 0 To ListBox1.Items.Count - 1
StrSort = ("INSERT into RPTPARAM (SORTBY) values ('" & ListBox1.DataValueField & "')")
Next
End If

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-04-19 : 03:57:03
Dim a As Integer
If ListBox1.Items.Count > 0 Then
For a = 0 To ListBox1.Items.Count - 1
StrSort = "INSERT into RPTPARAM (SORTBY) values ('" & ListBox1.DataValueField & "')"
Con.Execute(Strsort)
Next
End If

where con is the connection object

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

odeh83
Starting Member

8 Posts

Posted - 2006-04-19 : 04:36:06
thanx a lot madhivanan ;)
Go to Top of Page
   

- Advertisement -