|
-
Dec 23rd, 2002, 02:16 PM
#1
Thread Starter
Lively Member
MS Access and VB.NET
How can I connect to a database with this DAMN VB.NET to a database that is on another computer ???
Always get that the path is invalid (which is not) or that I do not have the permission (which I have) !!!
Anyone can help me ???
-
Dec 23rd, 2002, 02:30 PM
#2
Frenzied Member
Describe more about these DAMNs ! :P
-
Dec 23rd, 2002, 02:33 PM
#3
Thread Starter
Lively Member
Always get that the path is invalid (which is not) or that I do not have the permission (which I have) !!!
DUH !!!
-
Dec 23rd, 2002, 02:34 PM
#4
Thread Starter
Lively Member
Dim myConnection As OleDbConnection
Dim myCommand As OleDbCommand
Dim myReader As OleDbDataReader
'Use a variable to hold the ConnectionString.
Dim myConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
" Data Source=Y:\GestionsWeb\CPFMTCompteur\CPFMTCompteur.mdb"
'Create an OleDbConnection object,
'and pass in the ConnectionString to the constructor.
myConnection = New OleDbConnection(myConnectionString)
'Open the connection.
myConnection.Open()
bugging after that
-
Dec 23rd, 2002, 02:58 PM
#5
Frenzied Member
see if this format helps:
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=\\myServer\myShare\myPath\myDb.mdb"
-
Dec 23rd, 2002, 03:56 PM
#6
Thread Starter
Lively Member
Nop, didn't work either ...
-
Dec 23rd, 2002, 04:03 PM
#7
What error are you getting?
Also what did you change when it went from the path error to the permissions error?
Try building the connection string with the IDE in the server explorer and then cut and paste it into your code.
-
Dec 23rd, 2002, 04:12 PM
#8
Thread Starter
Lively Member
I've try with the Server Explorer and when I test with it, its working but when I paste the connection string in my code, then isn't working anymore :S
that's the error that I receive :
The Microsoft Jet database engine cannot open the file '\\Cpf-mtl-data\Data\Developpeurs\CPFMTLienDB\CPFMTLienDB.mdb'. It is already opened exclusively by another user, or you need permission to view its data.
-
Dec 23rd, 2002, 04:20 PM
#9
Frenzied Member
Do you have 'write' permission on that folder so it can place the lcok file on it?
-
Dec 23rd, 2002, 05:07 PM
#10
Try closing the connection that is open in the Server Explorer.
-
Dec 23rd, 2002, 05:25 PM
#11
Frenzied Member
Closing the connection in server explorer shoudn't make any difference as it has never made such an error when i work with my application while the connection in open in the explorer.
-
Dec 23rd, 2002, 05:31 PM
#12
Thread Starter
Lively Member
that's true, it doesn't make any difference
-
Dec 23rd, 2002, 05:37 PM
#13
It has for me before. Not usually but I have had the server explorer open the db exclusively and then I was blocked during the application. I assume it is some sort of bug in the IDE or something, but it has only happen to me once or twice.
-
Dec 23rd, 2002, 05:37 PM
#14
Frenzied Member
still i think you need 'write' permission on that network share.
-
Dec 25th, 2002, 05:16 PM
#15
New Member
Try opening the file over the network (outside of VB).
-
Dec 27th, 2002, 08:42 AM
#16
Thread Starter
Lively Member
Openning the DB outside VB works perfectly, and even in the Server Explorer so I don't understand why its simply don't work in my code ....
Dim myConnection As OleDbConnection
Dim myCommand As OleDbCommand
Dim myReader As OleDbDataReader
'Use a variable to hold the ConnectionString.
Dim myConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=\\Cpf-mtl-data\Data\Developpeurs\CPFMTLienDB\CPFMTLienDB.mdb"
'Create an OleDbConnection object,
'and pass in the ConnectionString to the constructor.
myConnection = New OleDbConnection(myConnectionString)
'Open the connection.
myConnection.Open() // Bug here !!!
By the way, its an Access 97 DB
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
|