I create a project. *I want to when I run the form2 form menu bar record will show automatically.
access database
vb.net 2010
connecting through coding
use connecting module
------------------------------------
in form load event
call connection
call showdata '---*I want to when I run the form2 form menu bar record will show automatically.
----------------------------------------------
call showdata coding
dim ds as new dataset
dim dt as new datatable
ds.table.add(dt)
dim da as new oledbdataadapter
da=new oledbdataadapter("select * from company", cn)
da.fill(dt)
text1.text=dt.rows(0).item(0)
text2.text=dt.rows(0).item(1)
Coding showing data perfect after add data
But when i other any thing change coding (for exampl. i add a text box for showing the datetime) and save then run the application and goto the form2 all records are delete automatically. then I add record and stop application then run 100 times work properly But when I press the save button after delete/add some blank space of coding window the when I run the application and opened the form2 there are no record. Please help me
What I have tried:
dim ds as new dataset
dim dt as new datatable
ds.table.add(dt)
dim da as new oledbdataadapter
da=new oledbdataadapter("select * from company", cn)
da.fill(dt)
text1.text=dt.rows(0).item(0)
text2.text=dt.rows(0).item(1)