Basscyst
05-08-2009, 12:33 AM
Having a bit of trouble connecting to a .dbf (Foxpro/Dbase) file.
OdbcConnection Conn = new OdbcConnection("Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=C:\\Inetpub\\wwwroot\\LegAid\\08Counties\\c001_g08_sov_data_by_g08_srprec. dbf;");
String SQL = "SELECT * FROM c001_g08_sov_data_by_g08_srprec.dbf";
Conn.Open();
OdbcCommand MyCommand = new OdbcCommand(SQL,Conn);
OdbcDataReader dr = MyCommand.ExecuteReader();
while (dr.Read())
{
Response.Write(dr[0].ToString() + "<br />");
}
I get the folowing error:
ERROR [HY024] [Microsoft][ODBC dBase Driver] '(unknown)' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.
ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed
ERROR [HY024] [Microsoft][ODBC dBase Driver] '(unknown)' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.
I did a Response.Write(Conn.ConnectionString) and it all looks right. When I try to run the file pointed to in the written Con String it pulls it right up. Just to test if it was a permission issue I set the IIS account to myself, an admin on the machine after simply impersonating myself when the code ran. Still nothing. It doesn't seem to be finding the file.
Am I using the wrong connection string? The file is on the servers local file system. Most every resource I've found solving this issue deals with a .dbf file on a remote machine, which doesn't pertain here.
Thanks.
OdbcConnection Conn = new OdbcConnection("Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=C:\\Inetpub\\wwwroot\\LegAid\\08Counties\\c001_g08_sov_data_by_g08_srprec. dbf;");
String SQL = "SELECT * FROM c001_g08_sov_data_by_g08_srprec.dbf";
Conn.Open();
OdbcCommand MyCommand = new OdbcCommand(SQL,Conn);
OdbcDataReader dr = MyCommand.ExecuteReader();
while (dr.Read())
{
Response.Write(dr[0].ToString() + "<br />");
}
I get the folowing error:
ERROR [HY024] [Microsoft][ODBC dBase Driver] '(unknown)' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.
ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed
ERROR [HY024] [Microsoft][ODBC dBase Driver] '(unknown)' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.
I did a Response.Write(Conn.ConnectionString) and it all looks right. When I try to run the file pointed to in the written Con String it pulls it right up. Just to test if it was a permission issue I set the IIS account to myself, an admin on the machine after simply impersonating myself when the code ran. Still nothing. It doesn't seem to be finding the file.
Am I using the wrong connection string? The file is on the servers local file system. Most every resource I've found solving this issue deals with a .dbf file on a remote machine, which doesn't pertain here.
Thanks.