FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

HOW TO USE TEXT FILE AS DATABASE IN VB & ADO

 


hamzasoft
here we go"
first of all we have to define two veriables the code is:
'code bigin from here
Option Explicit
Dim Conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
'code end here
after that at the form_load add this code:
'code bigin here again
Private Sub Form_Load()
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & App.Path & ";" _
& "Extended Properties='text;FMT=Delimited'"
Set rs = Conn.Execute("Select * from Data.txt ")
Dim field As ADODB.field
txtpurl.Text = rs.Fields(1)
Do Until rs.EOF
cbopname.AddItem rs.Fields(0)

rs.MoveNext
Loop
Set rs = Conn.Execute("Select * from Data.txt ")
End Sub
'code end here again
remember the project is using one text box name is txtpurl.text
and one combo box name is cbopname and the app is showing data inside of combobox from field one and when we select any data using combo it is navigating in textbox for navigate using combo code is
'code biggin here
Private Sub cbopname_Click()
Dim rs As New ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "Select * from [Data.txt] where [PNAME] = '" & cbopname.Text & "'", Conn, adOpenDynamic, adLockOptimistic
txtpurl.Text = rs.Fields(1).Value
End Sub
'code end here if any one have any quistion about this tutorial ask me at likehamza@yahoo.co.uk
Reply to topic    Frihost Forum Index -> Miscellaneous -> Tutorials

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.