-
Nov 4th, 2015, 07:15 AM
#1
Thread Starter
Fanatic Member
Access dbf file on a LAN machine
Hi,
We are using a Cannon manufacturing machine in our factory. It is using Windows Server operating system and it is connected to same network with my PC. I can view machine's dbf content in a datagridview if I copy the dbf file to my local computer with the following code:
Code:
Dim ConnectionString As String
ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=D:\;Extended Properties=dBase IV"
Dim dBaseConnection As New System.Data.OleDb.OleDbConnection(ConnectionString)
dBaseConnection.Open()
Dim dBaseCommand As New System.Data.OleDb.OleDbCommand("SELECT * FROM Shots2.dbf", dBaseConnection)
Dim dBaseDataReader As System.Data.OleDb.OleDbDataReader = dBaseCommand.ExecuteReader(CommandBehavior.SequentialAccess)
Dim dt = New DataTable()
dt.Load(dBaseDataReader)
DataGridView1.AutoGenerateColumns = True
DataGridView1.DataSource = dt
DataGridView1.Refresh()
dBaseConnection.Close()
What I need is a connection string with the path of the file in remote machine.
I found this string example but I couldn't find where to write file path:
Code:
"Data Source=192.168.3.98,4899;Network Library=DBMSSOCN;
Initial Catalog=myDataBase;User ID=PUC07;Password=12345678;"
It doesn't work in this form, ofcourse...
BTW, what is "Initial Catalog"? Should I use it?
Thanks a lot!
God, are you punishing me because my hair is better than yours? -Jack Donaghy
-
Nov 4th, 2015, 07:23 AM
#2
Re: Access dbf file on a LAN machine
Initial Catalog is used when connecting to a database system that is server-based, where there could be multiple databases... it defines the specific database to connect to... probably not needed in this case.
This is your original Data Source (which works)
"Data Source=D:\;Extended Properties=dBase IV"
So that's where you need to put the path of the database that's on the remote system.
-tg
-
Nov 4th, 2015, 07:32 AM
#3
Thread Starter
Fanatic Member
Re: Access dbf file on a LAN machine
First of all, thanks for your reply. Dbf file is somewhere in c:\ on the remote computer. Let say "C:\PUC7\Shots.dbf"
God, are you punishing me because my hair is better than yours? -Jack Donaghy
-
Nov 4th, 2015, 07:36 AM
#4
Re: Access dbf file on a LAN machine
Yeah, but it needs to be relative to YOU and the remote machine... I assume that it is in a shared folder since you said that you can copy it... that's the path you need to use... somehting like \\machine\sharefolder\anotherfolder\opnemorefolder\DatabaseName
-tg
-
Nov 4th, 2015, 07:47 AM
#5
Thread Starter
Fanatic Member
Re: Access dbf file on a LAN machine
Ahh, now I see... No, I am accessing to remote's local drive directly from Cannon's client software. Bad news, ain't it? I think it should be on a shared folder to access via VB.Net? But this is a default path where machine stores statics. I can't change it...
Last edited by Flashbond; Nov 4th, 2015 at 07:57 AM.
God, are you punishing me because my hair is better than yours? -Jack Donaghy
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|