1.how can i use gride in visual basic 6.0 using database access
2. how can i search the data in gride using textbox
3. how can i update,save,delete records in vb using query
Printable View
1.how can i use gride in visual basic 6.0 using database access
2. how can i search the data in gride using textbox
3. how can i update,save,delete records in vb using query
include Grid in ur form from Project->Components.
to display the data from database to Grid use following codings:
VB Code:
With MSFlexGrid1 .Rows = 1 .Rows = 2 i = .Row Set rview = d.Execute("select * from table1") MSFlexGrid1.Sort = 1 Do While Not rview.EOF .TextMatrix(i, 0) = rview!field1 .TextMatrix(i, 1) = rview!field2 .TextMatrix(i, 2) = rview!field3 rview.MoveNext .Rows = .Rows + 1 i = i + 1 Loop End With
To add, delete and update records.........first open connection using following codings:
VB Code:
conn.Close conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\db1.mdb;Persist Security Info=False" conn.Open
then normal SQL stmts are used to do required functions. for example:
VB Code:
Set rsave = d.Execute("insert into table1 values('" + Text1 + "','" + Text2 + "','" + Text3 + "','" + Text4 + "')")