Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Problem executing INSERT statement
Thu, May 26 2011 8:51 AMPermanent Link

Jan

Hi!

I'm just trying to execute a simple INSERT statement:

           using (Elevate.ElevateDB.Data.EDBCommand cmd = new Elevate.ElevateDB.Data.EDBCommand("", Conn))
           {
               Conn.ChangeDatabase("MyDatabase");
               cmd.ParamCheck = true;
               cmd.CommandText = "INSERT INTO Doc(DocName, Extension) VALUES(:DocName, :Extension)";

               cmd.Parameters["DocName"].Value = "blah";
               cmd.Parameters["Extension"].Value = "bluh";
               
               cmd.ExecuteNonQuery();
           }

I'm getting a EDBException (inner ex. is a NullReferenceException).
Stack trace:

  bei Elevate.ElevateDB.Data.EDBCommand.Execute()
  bei Elevate.ElevateDB.Data.EDBCommand.ExecuteNonQuery()
  bei ElevateDB.Form1.DocTestBtn_Click(Object sender, EventArgs e) in...

Do i have to set DbType or Size to the automatically created EDBParameter objects?

Regards an thanks,
Jan
Thu, May 26 2011 9:07 AMPermanent Link

Chris Holland

SEC Solutions Ltd.

Avatar

Team Elevate Team Elevate

Hi Jan,

I believe that the ODBCConnection has to be Open() before you can use the ChangeDatabase() function.

Chris Holland
[Team Elevate]

----------------------------------------------------------------------

Jan wrote:

Hi!

I'm just trying to execute a simple INSERT statement:

           using (Elevate.ElevateDB.Data.EDBCommand cmd = new Elevate.ElevateDB.Data.EDBCommand("", Conn))
           {
               Conn.ChangeDatabase("MyDatabase");
               cmd.ParamCheck = true;
               cmd.CommandText = "INSERT INTO Doc(DocName, Extension) VALUES(:DocName, :Extension)";

               cmd.Parameters["DocName"].Value = "blah";
               cmd.Parameters["Extension"].Value = "bluh";
               
               cmd.ExecuteNonQuery();
           }

I'm getting a EDBException (inner ex. is a NullReferenceException).
Stack trace:

  bei Elevate.ElevateDB.Data.EDBCommand.Execute()
  bei Elevate.ElevateDB.Data.EDBCommand.ExecuteNonQuery()
  bei ElevateDB.Form1.DocTestBtn_Click(Object sender, EventArgs e) in...

Do i have to set DbType or Size to the automatically created EDBParameter objects?

Regards an thanks,
Jan
Thu, May 26 2011 10:26 AMPermanent Link

Jan

Hi Chris!

> I believe that the ODBCConnection has to be Open()
> before you can use the ChangeDatabase() function.

The connection (ADO.NET) is open an i can execute SELECT statements.
Apart from that the driver should not throw a NullReferenceException if the connecion is closed.

Regards,
Jan
Thu, May 26 2011 10:51 AMPermanent Link

Jan

Hi!

I have just realized, that the INSERT statement was executed. A new row was inserted properly into the table.
So the exception is thrown after the execution...

Regards,
Jan
Tue, May 31 2011 2:56 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Jan,

<< I'm getting a EDBException (inner ex. is a NullReferenceException). >>

This was fixed in 2.05 B8:

http://www.elevatesoft.com/incident?action=viewrep&category=edb&release=2.05&incident=3455

--
Tim Young
Elevate Software
www.elevatesoft.com
Image