Bug when displaying data on a list view VB.Net with MySQL -


i came problem wasn't there before. on list view part of program, displays right data. happened (and tried in vain retrace steps couldn't remember touching codes of part), data on list view started not display properly.

the recent data adding aren't showing in list view , instead of being posted in bottom part of last successful data entry, gets inserted in beginning of list , shows blanks. whenever click update data there, won't display on list view.

where did go wrong? here's code:

displaying of data:

public sub loadpeople()     dim sqlquery string = "select * employee_table"     dim sqladapter new mysqldataadapter     dim sqlcommand new mysqlcommand     dim table new datatable     dim integer       sqlcommand         .commandtext = sqlquery         .connection = sconnection     end      sqladapter         .selectcommand = sqlcommand         .fill(table)      end      'listview fix     listview1.items.clear()       = 0 table.rows.count - 1         listview1             .items.add(table.rows(i)("id"))             .items(.items.count - 1).subitems                 .add(table.rows(i)("emp_no"))                 .add(table.rows(i)("emp_firstnm"))                 .add(table.rows(i)("emp_midnm"))                 .add(table.rows(i)("emp_lastnm"))                 .add(table.rows(i)("dept1"))                 .add(table.rows(i)("dept2"))                 .add(table.rows(i)("position"))                 .add(table.rows(i)("schedtype"))                 .add(table.rows(i)("date_hired"))             end         end     next  end sub 

adding of data:

private sub button1_click(sender system.object, e system.eventargs) handles button1.click     if sconnection.state = connectionstate.closed         sconnection.connectionstring = "server = localhost; userid = root; password=; database = cph;convert 0 datetime=true"         sconnection.open()     end if      dim sqlquery string = "insert employee_table(emp_no, emp_firstnm, emp_midnm, emp_lastnm, dept1, dept2, position, schedtype, date_hired) values ('" & txtempno.text & _         "','" & txtfname.text & "','" & txtmname.text & "','" & txtlname.text & "','" & txtdept1.text & "','" & txtdept2.text & "','" & txtposition.text & "','" & txtschedtype.text & "','" & txtdatehired.text & "')"     dim sqlcommand new mysqlcommand      sqlcommand         .commandtext = sqlquery         .connection = sconnection         .executenonquery()     end      msgbox("added new record")     dispose()     close()      'update     viewrecord.loadpeople() end sub 


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -