•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 391,913 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,703 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser:
Views: 8776 | Replies: 64 | Solved
![]() |
•
•
Join Date: Jun 2007
Posts: 166
Reputation:
Rep Power: 2
Solved Threads: 7
Last edited by AV Manoharan : Jul 20th, 2007 at 6:17 am.
Hi Suneel,
Add DAO reference :Microsoft DAO 3.51 object Library To ur Project and use thos code:
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
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
•
•
Join Date: Jul 2007
Posts: 71
Reputation:
Rep Power: 2
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
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
•
•
Join Date: Jul 2007
Posts: 71
Reputation:
Rep Power: 2
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
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
•
•
Join Date: Jul 2007
Location: Philippines
Posts: 160
Reputation:
Rep Power: 0
Solved Threads: 16
Hi vee!
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?
Set db = OpenDatabase(App.Path & "\COLOR.dbf", False, False, "dBase IV;")
Last edited by jireh : Jul 22nd, 2007 at 7:54 pm.
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
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 2:43 am.
•
•
Join Date: Jul 2007
Posts: 71
Reputation:
Rep Power: 2
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
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
Hi Suneel,
if u r using ADO, then open Connection like this:
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
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
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb Visual Basic 4 / 5 / 6 Marketplace
Similar Threads
- browsing file in VB? (Visual Basic 4 / 5 / 6)
- Reading or writing a double into a bin file (C++)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Spread sheet
- Next Thread: vb6-excel


Linear Mode