2
Contributors
10
Replies
15
Views
6 Years
Discussion Span
Last Post by x2fair
0

Assuming that I have 5 items in the listbox and i want it to save to the five fields of the my mysql database..

can you show me some codes...??
thank you.

0
...
_cmd=new MySqlCommand();
...
_cmd.CommandText="insert into table Test values(?col1,?col2,?col3,?col4,?col5)"
_cmd.Parameters.AddWithValue("?col1", listbox1.items(0))
_cmd.Parameters.AddWithValue("?col2", listbox1.items(1))
_cmd.Parameters.AddWithValue("?col3", listbox1.items(2))
_cmd.Parameters.AddWithValue("?col4", listbox1.items(3))
_cmd.Parameters.AddWithValue("?col5", listbox1.items(4))
...
0
Dim my_cmd As MySqlCommand
                        my_cmd = New MySqlCommand()
                        my_cmd.CommandText = "insert into documenttable Test values(?route1,?route2,?route3,?route4,?route5,?route6,?route7,?route8,?route9,?route10,?route11,?route12)"
                        rs.Open(query, conn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic)
                        my_cmd.Parameters.AddWithValue("?route1", .ListBox1.Items(0))
                        my_cmd.Parameters.AddWithValue("?route2", .ListBox1.Items(1))
                        my_cmd.Parameters.AddWithValue("?route3", .ListBox1.Items(2))
                        my_cmd.Parameters.AddWithValue("?route4", .ListBox1.Items(3))
                        my_cmd.Parameters.AddWithValue("?route5", .ListBox1.Items(4))
                        my_cmd.Parameters.AddWithValue("?route6", .ListBox1.Items(5))
                        my_cmd.Parameters.AddWithValue("?route7", .ListBox1.Items(6))
                        my_cmd.Parameters.AddWithValue("?route8", .ListBox1.Items(7))
                        my_cmd.Parameters.AddWithValue("?route9", .ListBox1.Items(8))
                        my_cmd.Parameters.AddWithValue("?route10", .ListBox1.Items(9))
                        my_cmd.Parameters.AddWithValue("?route11", .ListBox1.Items(10))
                        my_cmd.Parameters.AddWithValue("?route12", .ListBox1.Items(11))

"It does not work with this command...."
can show show me line by line.???

Edited by __avd: Added [code] tags.

0
my_cmd.CommandText = "insert into documenttable values(?route1,?route2,?route3,?route4,?route5,?route6,?route7,?route8,?route9,?route10,?route11,?route12)"
0

Is there any way that I can help? Tell me about your program please.

1. Name of Table
2. Number of columns and type of each column

0

my program have two listbox which we say as listbox1 and listbox2 and two command button b1 and b2. listbox1 contains items list.like chicken, frog and etc. when i choose chicken and i clicked b1 the item chicken is remove from listbox1 and goes to listbox2 and so on.Now when I clicked b2 it must be save into mysql database.but how???

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.