I created an ASP.Net 4.0 website and make an OLEDB connection with Visual Foxpro 8.0 databse for selecting data from a table. Used code is written below...
string strConnString = "Provider=vfpoledb;Data Source=C:\Users\mohammads\Documents\Visual FoxPro Projects\dbTallowMaster.dbc;";
OleDbConnection connection = new OleDbConnection(strConnString);
connection.Open();
string username = "675";
string password = "675";
string sqlQuery = "SELECT userinfoid, username, password FROM tm_userinfo.dbf WHERE username = \"" + username + "\" AND password = \"" + password + "\"";
OleDbCommand cmd = new OleDbCommand(sqlQuery, connection);
OleDbDataAdapter oOleDbDataAdapter = new OleDbDataAdapter(cmd);
DataTable dt = new DataTable();
oOleDbDataAdapter.Fill(dt);
this code is working fine in local system but when I hosted this site on Windows 7 IIS 6.0 then connection doesn't open and I get error that "invalid path or file name". Please suggest me why this code creates problem only when I host it in IIS.
Is there should be some change in datasource of connection string while hosting site in IIS.