Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

ConnectionString / DSNLess

1 réponse
Avatar
mml
Bonjour,

Voulant créer une connexion DSNLess, j'écris :

cnx.ConnectionString = "Driver={Microsoft Access Driver
(*.mdb)};Dbq=http://www.toto.com/data/toto.mdb"
(ou bien : cnx.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=http://www.toto.com/data/toto.mdb")
cnx.Open

et j'obtiens "Erreur d'exécution '-2147467259(80004005)':
Nom de fichier incorrect

alors que les lignes :

cnx.ConnectionString = "Driver={Microsoft Access Driver
(*.mdb)};Dbq=M:\toto\data\toto.mdb"
(ou bien : cnx.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=M:\toto\data\toto.mdb")
cnx.Open

marchent très bien.
Quelqu'un voit-il pourquoi ?

--
Cordialement,

Marc LAGARDETTE

1 réponse

Avatar
cyberjc
Http:// etc représente un chemin virtuel, interprété par des browsers
uniquement. Pour l'utiliser dans du code il faut le traduire en chemin
physique d'où le fait que cela marche quand tu indiques le drive.


Bonjour,

Voulant créer une connexion DSNLess, j'écris :

cnx.ConnectionString = "Driver={Microsoft Access Driver
(*.mdb)};Dbq=http://www.toto.com/data/toto.mdb"
(ou bien : cnx.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=http://www.toto.com/data/toto.mdb")
cnx.Open

et j'obtiens "Erreur d'exécution '-2147467259(80004005)':
Nom de fichier incorrect

alors que les lignes :

cnx.ConnectionString = "Driver={Microsoft Access Driver
(*.mdb)};Dbq=M:totodatatoto.mdb"
(ou bien : cnx.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=M:totodatatoto.mdb")
cnx.Open

marchent très bien.
Quelqu'un voit-il pourquoi ?

--
Cordialement,

Marc LAGARDETTE