TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Kevin Davis
NA
52
51.2k
Updating a MySQL database with items from a listview
May 7 2012 10:25 AM
I have a listview with a few columns, and I'm trying to choose all items and add each of them to my MYSQL database online. However, when I try to run the script, it will either only update the first record, or the last record, but never all the records. Any help would be appreciated. Thank you.
Dim strsql As String
For i = 0 To ListView1.Items.Count - 1
Dim a As String = ListView1.SelectedItems(i).SubItems(15).Text---------------------------Customer Name Column
Dim b As Integer = CInt(ListView1.SelectedItems(i).Text)------------------------------------Id Number of Customer
'strsql = "Update orders SET Name = '" & ListView1.SelectedItems(i).SubItems(15).Text & "' where ID = '" & ListView1.SelectedItems(i).Text & "'"
strsql = "Update orders SET Name = '" & a & "' where ID = '" & b & "'"
Dim da As New MySqlDataAdapter(strsql, CONNECTION)
Next
da.Fill(ds)
I've tried a couple different ways of doing this, and it "partially" works either way. I also get a error stating that "the integer i will not be inferred as it is bound to a filed in an enclosing scope."
Thanks again for any help.
Zcast
Reply
Answers (
11
)
Microsoft Strategy for Hadoop
how to call the session to record in another table mssql wih vb.net