Results 1 to 5 of 5

Thread: Access dbf file on a LAN machine

  1. #1

    Thread Starter
    Fanatic Member Flashbond's Avatar
    Join Date
    Jan 2013
    Location
    Istanbul
    Posts
    646

    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

  2. #2
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Fanatic Member Flashbond's Avatar
    Join Date
    Jan 2013
    Location
    Istanbul
    Posts
    646

    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

  4. #4
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5

    Thread Starter
    Fanatic Member Flashbond's Avatar
    Join Date
    Jan 2013
    Location
    Istanbul
    Posts
    646

    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
  •  



Click Here to Expand Forum to Full Width