Errors occur everywhere there is an attempt to access a database table, such as with “TextTable texttable = db.TextTables.SingleOrDefault(p => p.TexID == TextID);” which state: Error 16 'System.Data.Linq.Table<TransLangTable>' does not contain a definition for 'SingleOrDefault'. Errors also occur whenever there is an attempt to access the database directly such as with “SqlConnection conn = null;” which state: Error 52 The type or namespace name 'SqlConnection' could not be found.
Obviously, I included a “using System.Data.SqlClient;” statement in the code section along with many others. There is also a statement of: “<add name="ENCdbConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ENCdb.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/> within the connectionStrings portion of the web.config file. In addition, there is, “string ENCconn = ConfigurationManager.ConnectionStrings["ENCdbConnectionString"].ToString();” at the start of the script portion of the code.
I believe that the problem is due to the fact that I only copied the database and DataClasses from another website into my current website instead of creating them directly. For some reason, the Debug function cannot relate to any of my code that relates to the database. I even attempted to copy the code into a new web page file within the other website where all other web pages work fine with the database. However, I obtained the exact same results with this file when I attempted to run it. What am I doing wrong? Please help.
Maurice