|
-
Jul 23rd, 2008, 01:50 AM
#1
Thread Starter
Lively Member
sql insert query for inserting mutliple records
i have a listbox with more than one record, 2 textbox
i want to insert the data from all 3 objects in the sql table but with the below code i am not able to insert it.
eg suppose i have 2 names in listbox1 , name1, name 2 & in first textbox A & second textbox "1"
against both the names the data of text box shld be insetred
eg
A name1 1
A name2 1
For i = 1 To ListBox1.Items.Count
If ListBox1.Items(i - 1).selected = True Then
strqry = "insert into trans(cid,pid,lid) values('" & textBox1.Text & "','" & ListBox1.Items(i - 1) & "','" & textBox2.Text & "')"
cmd.CommandText = strqry
cmd.ExecuteNonQuery()
end if
next
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
|