Firstly what is your connection string exactly? As you are trying to connect server side you should build the string and Response.Write it out before trying to connect. Is the path correct and does your IIS account have read/write permissions to the folder and database file?
Personally I would never connect with ODBC to an Access database I would use something like this:
Code:
function getAccessConnectionString(Path)
{
var sPhysicalPath = Path;
if (sPhysicalPath.indexOf("\\") == -1)
{
sPhysicalPath = Server.MapPath(Path);
}
var sConnString = Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + sPhysicalPath + ";User Id=admin;Password=;"
//For debug
//Response.Write(sConnString);
return sConnString;
}
You can pass a relative url such data/myDB.mdb or the full path, "C:\inetpub\wwwroot\myApp\data\myDB.mdb" (remeber to double up backslashes in JavaScript.
That's for standard security, if your database is password protected or has Access groups etc. see
http://www.connectionstrings.com for other versions.
--
Joe (
Microsoft MVP - XML)