So I'm building a website on the local host and I have a database in C: \ inetpub \ wwwroot \ lollipops \ App_Data \ lollipopdb.mdb requires me to use on my website but when I try to make a SELECT statement on it, I give this error: "System.ArgumentException: The keyword is not supported: 'Provider'. "
This is in my web .config file -
& lt; ConnectionStrings & gt; & Lt; Name = "lollipopdbie" connection string = "provider = microsoft.jset.l.tdb..4.0; data source = c: \ inetpub \ wwwroot \ lollipops \ app_Data \ lollipopDB.mdb;" Providence = "System.Data.OleDb" /> & Lt; / ConnectionStrings & gt;
And works on the website PerformSQL which takes the name of a connection string and sql string to run.
public void PerformSQL (string conn, string sqlStr) {sqlConn.ConnectionString = ConfigurationManager.ConnectionStrings [conn]. ConnectionString; Sql.CommandText = sqlStr; Sql.Connection = sqlConn; // specify the connection string for the command frequency sqlConn.Open (); Sql.ExecuteNonQuery (); SqlConn.Close (); }
What is the type of sqlcon?
It should be OleDbConnection. Similarly, the command should be ODDBI compliant.
No comments:
Post a Comment