Tablename not recognized

I have an app that works perfectly on a stand-alone computer, interacting with an MS Access database containing two tables.

However, I have been tasked with incorporating this app into an agency-wide SQL Server database. The existing data has been copied into its "new home", but the table names chosen by the DBA produce errors(not recognized) when I write and execute a query.

Any ideas on how to proceed?

Particularly, the table names produce an error in DbSet statements.

Care to share these exact errors as we don't have powers to see them remotely

CS0246: The type or namespace name could not be found (are you missing a using directiveor an assembly reference?)

What is being rejected is the identifier within the < > of a DbSet declaration. How do I determine what to enter there?

this sounds more of an acess/vba question than a sql question?
please show us some code.

the more you share the more we can help you.

identifier within the < > of a DbSet declaration is not enough

It's SQL Server...not Access.

public class ExistingRecordsModel : PageModel
{
    public List<ExistingFormInfo> ExistingRecords = new List<ExistingFormInfo>();        public void OnGet()
    {
        try
        {
            string connectionString = "Data Source=WWYKL-0CJA3K\\SQLEXPRESS;Initial Catalog=aodms_db;Integrated Security=True";
            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                connection.Open();
                string sql = "SELECT * FROM T__AODMS_tracking_fields";
                using (SqlCommand command = new SqlCommand(sql, connection))
                {
                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            ExistingFormInfo existingFormInfo = new ExistingFormInfo();
                            existingFormInfo.ID = reader.GetString(0);
                            existingFormInfo.LeadCommandControlNo = reader.GetString(1);
                            existingFormInfo.ModTitle = reader.GetString(2);
                            existingFormInfo.ProposalDate = reader.GetDateTime(3);
                            existingFormInfo.Initiator = reader.GetString(4);
                            existingFormInfo.Org = reader.GetString(5);
                            existingFormInfo.DateRecvd = reader.GetDateTime(6);

                            ExistingRecords.Add(existingFormInfo);
                        }
                    }
                }
            }
        }
        catch (Exception ex)
        {

        }
    }

(I'm getting error messages inferring that what was valid in a previoius release of a Nuget package is invalid in a later release of the same Nuget package.)

Severity Code Description Project File Line Suppression State
Error CS1069 The type name 'SqlConnection' could not be found in the namespace 'System.Data.SqlClient'. This type has been forwarded to assembly 'System.Data.SqlClient, Version=4.6.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' Consider adding a reference to that assembly. AFForm1067Tracker C:\Users\1231447608C\Documents\Training\AODMS migration training\AFForm1067Tracker\Pages\Existing.cshtml.cs 19 Active

the code you are showing is not SQL. It looks like .net or vba code.
Sounds like you have lingering dll references to the old System.Data.SqlClient in your project

The newest(!) version of System.Data.SqlClient is the one that is giving the error.
As noted in the error description I included, it says to revert to a previous version of the package, and that is what is confusing.
Why would an earlier version not cause an error, while the later versions indeed cause an error?
I thought the whole idea of creating new versions was to eliminate(!) errors--not cause(!) more.

Welcome to the world of software development. Newer versions of a lot of softwares if not most do introduce new issues as sure as the sun rises in the East

There has been some confusion/overlap between System.Data.SqlClient and Microsoft.Data.SqlClient. Not sure if your issue is related to that, but might be worth investigating.

1 Like