System.Data.SQLite

Login
This project makes use of Eagle, provided by Mistachkin Systems.
Eagle: Secure Software Automation
Ticket Hash: 47097a869aec523320538dcaec8063ee5b5a662e
Title: Adapter.Fill DataTable Name
Status: Closed Type: Question
Severity: Minor Priority: Medium
Subsystem: Data_Adapter Resolution: Not_A_Bug
Last Modified: 2017-04-03 23:12:43
Version Found In: 1.0.104
User Comments:
anonymous added on 2017-02-10 03:47:50:
I want to expose the ViewModel in memory for accessing them without Sql,
I use adapter.Fill to fill the all the table, but the name is Table, Table1,
Table2, Table3, not the PDSCH, PDSCH_DEP, PDSCH_View, BDepartment instead,
it's not trivial and if I change the selection sequence, it will broken, can we
change it?

Example:

Case1 No Conflict:
   Query = "SELECT * FROM MyTable1;SELECT * FROM MyTable2";
   There will be 2 tables named "MyTable1", "MyTable2" after Filling DataSet

Case2 Name Conflict:
   Query = "SELECT * FROM MyTable1;SELECT * FROM MyTable1";
   There will be 2 tables named "MyTable1", "MyTable1_1" after Filling DataSet

Look the following code:

private DataSet _DataSet;

        /// <summary>
        /// Get the underlying dataset
        /// </summary>
        public DataSet DataSet
        {
            get { return _DataSet; }
        }

        /// <summary>
        /// Get the Default Instance of LocalDB
        /// </summary>
        public static LocalDB Default
        {
            get
            {
                if (_Default == null) _Default = new LocalDB();
                return _Default;
            }
        }

        public static SQLiteConnection GetLocalDBConnection()
        {
            return new SQLiteConnection("Data source=" + LoginForm.DefaultDBPath);
        }

        public LocalDB()
        {
            var conn = GetLocalDBConnection();

            var cmd = conn.CreateCommand();

            SQLiteDataAdapter adapter = new System.Data.SQLite.SQLiteDataAdapter(cmd);

            cmd.CommandText = "SELECT * FROM PDSCH; SELECT * FROM PDSCH_DEP; SELECT * FROM PDSCH_View; SELECT * FROM BDepartment";

            conn.Open();
            try
            {
                if (_DataSet == null)
                    _DataSet = new System.Data.DataSet();
                adapter.Fill(_DataSet);
            }
            finally
            {
                conn.Close();
            }
        }

        public DataTable BDepartment
        {
            get { return _DataSet.Tables["Table3"]; }
        }

        // Access the Default LocalDB
        private static LocalDB _Default;
    }

mistachkin added on 2017-02-10 17:03:54: (text/x-fossil-plain)
This type of question is better handled on the mailing list:

[/doc/trunk/www/support.wiki]