vb.net - MySQL DataGridView bind -


i have following code connect mysql server

    dim oconn mysqlconnection     dim sconnstr string     dim odbadapter mysqldataadapter     dim otable data.datatable     sconnstr = string.format("server=localhost;user=user; password=pass; database=db; pooling=false") '     oconn = new mysqlconnection(sconnstr)     oconn.open()     otable = new data.datatable()     odbadapter = new mysqldataadapter("select * test", oconn)     datagridview1.datasource = otable     odbadapter.fill(otable) 

this code works, however, when switch order of last 2 row

    dim oconn mysqlconnection     dim sconnstr string     dim odbadapter mysqldataadapter     dim otable data.datatable     sconnstr = string.format("server=localhost;user=user; password=pass; database=db; pooling=false") '     oconn = new mysqlconnection(sconnstr)     oconn.open()     otable = new data.datatable()     odbadapter = new mysqldataadapter("select * test", oconn)     odbadapter.fill(otable)     datagridview1.datasource = otable 

when i'm using step step, noticed command run .fill command , skipped assigning datagridview.

not sure why happening, since make more sense "after getting data sql, assign datagridview"

ps: datagridview empty grid nothing assigned in it.


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -