reading records from a .dbf file
anyone who can help me regarding how to read data from .dbf files recordwise.
suneel kar
Junior Poster in Training
71 posts since Jul 2007
Reputation Points: 10
Solved Threads: 1
hi veena ,
thanx for replyin. will u plz tell me what actually this statement does in code.
con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & App.Path & "\Resources\MNYL.mdb ; Persist Security Info=False"
As i am new to programming in visual basics so tell me any way to get every cocept clear.
any book if u recomend me .will be thankful.
dabasish and u have strong knowlge of vb .keep it up .
regards
suneel kar
Hi Suneel,
Add DAO reference :Microsoft DAO 3.51 object Library To ur Project and use thos code:
Dim DB As Datbase
Dim RST As RecordSet
Dim sSQL As String
Set DB = DBEngine.OpenDatabase("C:\MyDBFFolder", False, False, "dBASE III;")
sSQL= "Select * From MyTable"
Set RST= DB.penRecordset(sSQL)
Note In Above DB Statement, u have to specify the path of Folder Name where Dbf files are Located. and u can change the
DBase III according to ur dbase version.
REgards
Veena
suneel kar
Junior Poster in Training
71 posts since Jul 2007
Reputation Points: 10
Solved Threads: 1
hi veeva
i am gettin confused dear. as per debashish he is sayin ADO is advanced one which we r using now and u sayin DAO
sort out the things and reply which to use
regards
suneel kar
hi veena ,
thanx for replyin. will u plz tell me what actually this statement does in code.
con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & App.Path & "\Resources\MNYL.mdb ; Persist Security Info=False"
As i am new to programming in visual basics so tell me any way to get every cocept clear.
any book if u recomend me .will be thankful.
dabasish and u have strong knowlge of vb .keep it up .
regards
suneel kar
suneel kar
Junior Poster in Training
71 posts since Jul 2007
Reputation Points: 10
Solved Threads: 1
hello debashish,veena
have alook n the code.when i am compiling this it is givin me unknown databse format.
regards
suneel
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Private Sub Command1_Click()
con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & App.Path & "\CHECK_2045.dbf ; Persist Security Info=False"
rs.Open Text1.Text, con, adOpenForwardOnly, adLockOptimistic
Dim str As String
If Dir("c:\Suneel_Development\New Folder\record reading\data.txt") <> "" Then
Kill "c:\Suneel_Development\New Folder\data.txt"
End If
Open "c:\Suneel_Development\New Folder\DATA.TXT" For Append As #1
Do While rs.EOF = False
For i = 0 To rs.Fields.Count - 1
If i < rs.Fields.Count - 1 Then
str = str & IIf(IsNull(rs(i)), "null", rs(i)) & Chr(9)
Else
str = str & IIf(IsNull(rs(i)), "null", rs(i))
End If
Next
Print #1, str
rs.MoveNext
str = ""
Loop
Close #1
rs.Close
con.Close
End Sub
Hi Jireh,
Look as i said in my post u should mention only dbf's "Path" change "C:\report\Color.dbf" this to "C:\report"
DBF files donot have the concept of Single Databeas, each tables are stored as seperate files, thats the reason we need to mention Folder path of dbf files. Hi Suneel, DBF is a older technology of databases. It may be possible to open dbf with ADO also, but I think they can be accessed fast using DAO's . Regards Veena
suneel kar
Junior Poster in Training
71 posts since Jul 2007
Reputation Points: 10
Solved Threads: 1
hi veena .
con.open statement worked.
"rs.Open Text1.Text, con, adOpenForwardOnly, adLockOptimistic"
what it does actually.reply
regards
suneel
Hi Suneel,
if u r using ADO, then open Connection like this:
con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & ";Extended Properties=DBase IV"
u have to give Extended properties in connection string, and when it comes to .dbf or older Foxpro Versions of data, they dont have a single DB, u have to mention Folder path name.
Regards
Veena
suneel kar
Junior Poster in Training
71 posts since Jul 2007
Reputation Points: 10
Solved Threads: 1
hi veena
is it possible that text1.txt can contain CHECK_2045.pdf.
can i give the name of folder directly where CHECK_2045 is present.
CHECK_2045 is present in C:\Suneel_development\New Folder\record reading\CHECK_2045.pdf
may i write like this
"rs.Open CHECK_2045.pdf, con, adOpenForwardOnly, adLockOptimistic
it is giving object required error.
wt to do here
regards
suneel
Hi Suneel,
What does ur Text1.Text contain...?
It shoud have either Table name (CHECK_2045) or a Select Query Statment (Select * From CHECK_2045)
Regards
Veena
suneel kar
Junior Poster in Training
71 posts since Jul 2007
Reputation Points: 10
Solved Threads: 1
hi veena
we cannot open PDF files with ADO in VB6.is it so.
i placed CHECK_2045.dbf In MyTable and tried ur cde buttttt it could not find the MyTable
if u dont mind may i send u my project.
reply soon
suneel kar
Junior Poster in Training
71 posts since Jul 2007
Reputation Points: 10
Solved Threads: 1
hi i was waitin for ur reply but u went offline. hey how to send projct to u.may i have ur mail id where i can send it .
reply now
regards
suneel
Hi,
Create Folder "MyDBF" in C
and place all dbfs's there in ("c:\MyDBF")
and use this code:
con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyDBF; Extended Properties=DBase IV"
rs.Open "Select * from CHECK_2005", con, adOpenForwardOnly, adLockOptimistic
Yes, u can send me the project. I will modify and return back.
Regards
Veena
suneel kar
Junior Poster in Training
71 posts since Jul 2007
Reputation Points: 10
Solved Threads: 1
ya i got ur pvt msg.
veena my gmail id is [email]suneelkashmiri@gmail.com[/email],rediff id is [email]kar_suneel022@rediffmail.com[/email]
add me there .
modify the project and send it in my gmail id .
with regards
suneel kar
Hi,
U can Zip and upload the proj here, or i have sent u pvt msg abt my email id
Regards
Veena
suneel kar
Junior Poster in Training
71 posts since Jul 2007
Reputation Points: 10
Solved Threads: 1
hi veena
if possible give me ur gmail id i will be thankful to u.
regards
suneel kar
suneel kar
Junior Poster in Training
71 posts since Jul 2007
Reputation Points: 10
Solved Threads: 1