EffiProzDB.HsqlException exception _in statement [CREATE TABLE Test]

Sep 9, 2009 at 1:15 AM

 

EffiProzDB.HsqlException exception _in statement [CREATE TABLE Test]


            string connString = "Type=Memory ; Data Source=TestDB; User=sa; Password=;";
            string sql = "CREATE TABLE Test (ID INT, Name VARCHAR);";
            using (DbConnection conn = new EffiProzDBConnection(connString))
            {
                DbCommand command = conn.CreateCommand();
                command.CommandText = sql;
                conn.Open();
                command.ExecuteNonQuery();
                command.CommandText = "INSERT INTO Test(ID, Name) VALUES(1, 'Chris'); INSERT INTO Test(ID, Name) VALUES(2, 'Sam')";
                command.ExecuteNonQuery();
                command.CommandText = "SELECT * FROM Test;";
                DataTable data = new DataTable();
                DbDataAdapter da = new EffiProzDBDataAdapter((EffiProzDBCommand)command);
                da.Fill(data);
                foreach (DataRow item in data.Rows)
                {
                    Console.Write("ID: " + item[0] + ", Name: " + item[1]);
                }
            }
            string connString = "Type=Memory ; Data Source=TestDB; User=sa; Password=;";
            string sql = "CREATE TABLE Test (ID INT, Name VARCHAR);";
            using (DbConnection conn = new EffiProzDBConnection(connString))
            {
                DbCommand command = conn.CreateCommand();
                command.CommandText = sql;
                conn.Open();
                command.ExecuteNonQuery(); //exception throws here
                command.CommandText = "INSERT INTO Test(ID, Name) VALUES(1, 'Chris'); INSERT INTO Test(ID, Name) VALUES(2, 'Sam')";
                command.ExecuteNonQuery();
                command.CommandText = "SELECT * FROM Test;";
                DataTable data = new DataTable();
                DbDataAdapter da = new EffiProzDBDataAdapter((EffiProzDBCommand)command);
                da.Fill(data);
                foreach (DataRow item in data.Rows)
                {
                    Console.Write("ID: " + item[0] + ", Name: " + item[1]);
                }
            }

 

Coordinator
Sep 9, 2009 at 5:38 AM

Its seems table "Test" already exist in "TestDB" database. Do you create another connection to "TestDB" above this code fragment?

Do you get any more information with the exception (stacktrace ....)? I'm not surprised if you don't .... refining error reporting is also part of our future road map :-)

Sep 9, 2009 at 5:52 AM

sorry, my mistake. I used 2 sets of sample code, the first is the native methods, and the second is ado.net