Results 1 to 2 of 2

Thread: implement client-server

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2005
    Posts
    18

    implement client-server

    Hello,

    i m developing an application in vb and MS-Access.The application require to access database that is on server by clients.How can i achieve this.
    do i need to use dsn-less connection or it can be done using dsn only.

    need explaination in detail with code.

    Thanks
    Ashish

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: implement client-server

    I don't see the point of using DSN's, it is much less hassle to use DSN-less, as you do not need to set up a DSN on each PC that your program may be run on.

    In order to have an Access database on a server (or any remote computer) you need to store it in a shared folder on that server, with permissions given to the users to modify files in that folder.

    You can then use a connection string which maps to that location. Here is an ADO sample:
    VB Code:
    1. Dim cnn As ADODB.Connection
    2. Dim rst As ADODB.Recordset
    3. Dim strSQL As String
    4.   Set cnn = New ADODB.Connection
    5.   cnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=[U]\servername\shared folder name\mydb.mdb[/U];User Id=admin;Password=;"
    6.   cnn.Open
    7.  
    8.   Set rst = New ADODB.Recordset
    9.   strSQL = "SELECT * FROM table1"
    10.   rst.Open strSQL, cnn, adOpenKeyset, adLockPessimistic, adCmdText
    11.  
    12.   rst.Close
    13.   Set rst = Nothing
    14.  
    15.   cnn.Close
    16.   Set cnn = Nothing

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