reading records from a .dbf file

Thread Solved

Join Date: Jul 2007
Posts: 71
Reputation: suneel kar is an unknown quantity at this point 
Solved Threads: 1
suneel kar suneel kar is offline Offline
Junior Poster in Training

reading records from a .dbf file

 
0
  #1
Jul 20th, 2007
anyone who can help me regarding how to read data from .dbf files recordwise.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 166
Reputation: AV Manoharan is an unknown quantity at this point 
Solved Threads: 9
AV Manoharan AV Manoharan is offline Offline
Junior Poster

Re: reading records from a .dbf file

 
0
  #2
Jul 20th, 2007
Originally Posted by suneel kar View Post
anyone who can help me regarding how to read data from .dbf files recordwise.
See it in the thread Access to any type of DB's possible for your dbase and opening 2 files for your writng records to text files


regards
AV Manoharan
Last edited by AV Manoharan; Jul 20th, 2007 at 7:17 am.
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: reading records from a .dbf file

 
0
  #3
Jul 21st, 2007
Hi Suneel,

Add DAO reference :Microsoft DAO 3.51 object Library To ur Project and use thos code:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Dim DB As Datbase
  2. Dim RST As RecordSet
  3. Dim sSQL As String
  4. Set DB = DBEngine.OpenDatabase("C:\MyDBFFolder", False, False, "dBASE III;")
  5. sSQL= "Select * From MyTable"
  6. 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
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 71
Reputation: suneel kar is an unknown quantity at this point 
Solved Threads: 1
suneel kar suneel kar is offline Offline
Junior Poster in Training

Re: reading records from a .dbf file

 
0
  #4
Jul 21st, 2007
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









Originally Posted by QVeen72 View Post
Hi Suneel,

Add DAO reference :Microsoft DAO 3.51 object Library To ur Project and use thos code:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Dim DB As Datbase
  2. Dim RST As RecordSet
  3. Dim sSQL As String
  4. Set DB = DBEngine.OpenDatabase("C:\MyDBFFolder", False, False, "dBASE III;")
  5. sSQL= "Select * From MyTable"
  6. 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
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 71
Reputation: suneel kar is an unknown quantity at this point 
Solved Threads: 1
suneel kar suneel kar is offline Offline
Junior Poster in Training

Re: reading records from a .dbf file

 
0
  #5
Jul 21st, 2007
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




Originally Posted by suneel kar View Post
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
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 300
Reputation: jireh is an unknown quantity at this point 
Solved Threads: 42
jireh's Avatar
jireh jireh is offline Offline
Posting Whiz

Re: reading records from a .dbf file

 
0
  #6
Jul 22nd, 2007
Hi vee!
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Set db = OpenDatabase(App.Path & "\COLOR.dbf", False, False, "dBase IV;")
I try your code because I also use some dBase but it has an error "C:\report\Color.dbf" isn't a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.I don't understand why because the color.dbf file is in the folder c:\report and my VB Project is also on that folder too. Why it makes an error like that?
Last edited by jireh; Jul 22nd, 2007 at 8:54 pm.
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: reading records from a .dbf file

 
0
  #7
Jul 23rd, 2007
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
Last edited by QVeen72; Jul 23rd, 2007 at 3:43 am.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 71
Reputation: suneel kar is an unknown quantity at this point 
Solved Threads: 1
suneel kar suneel kar is offline Offline
Junior Poster in Training

Re: reading records from a .dbf file

 
0
  #8
Jul 23rd, 2007
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








Originally Posted by QVeen72 View Post
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
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: reading records from a .dbf file

 
0
  #9
Jul 23rd, 2007
Hi Suneel,

if u r using ADO, then open Connection like this:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. 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
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: reading records from a .dbf file

 
0
  #10
Jul 23rd, 2007
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
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC