Conversion from type 'DBNull' to type 'String' is not valid. (Oracle10gR2)


Author
Message
Kari Paukku
Kari Paukku
StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)
Group: Forum Members
Posts: 65, Visits: 820
Hi,

when retrieving data from Oracle database a VARCHAR2 field being NULL gives an expections. When there is text in the field then the select works ok.

What might be the problem here and how can it be solved?

TIA,

Kari

ps. I did find some other post related to null values put not quite like this. Also, when can we expect the next release with the DevExpress wrapper among other enhancements :-)

Picture attached

Attachments
nullexception.gif (190 views, 14.00 KB)
StrataFrame Team
S
StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
You will need to go through the BOMapper and customize your "WWW" field so that it will return an alternate value on NULL.  Within the BOMapper, select the business object, then select the WWW field.  Right-click the field and select Customize from the context menu.  In the customization dialog, select "Return Alternate On Null" as the null value handling type, and then set the return value to either "Nothing" or "String.Empty" (without the quotes) and the field will return the appropriate value when a NULL value exists in the database.

As for the DevExpress wrapper, I'm building the install right now.

Kari Paukku
Kari Paukku
StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)
Group: Forum Members
Posts: 65, Visits: 820
Hi Ben,

thanks, that worked fine.

Kari

ps. Is there hope that we would have the next release available still this weekend?

Kari Paukku
Kari Paukku
StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)
Group: Forum Members
Posts: 65, Visits: 820
Hi,

one additional problem: when I try to update the WWW-field I get "ORA-00936 Missing Expression" error.

So this is an Oracle error saying - I guess - that there is a problem with the update SQL-statement. What might go wrong here and is there a way to see the update statement SF is sending to the database.

Thanks again,

Kari

The error window "An error occured while saving an the data to the server"
================

BusinessLayerException
 An error occurred while saving an the data to the server.
DataLayerSavingException
 ORA-00936: missing expression

OracleException
 ORA-00936: missing expression


Source     : MicroFour StrataFrame Business

Stack Trace:
   at System.Data.OracleClient.OracleConnection.CheckError(OciErrorHandle errorHandle, Int32 rc)
   at System.Data.OracleClient.OracleCommand.Execute(OciStatementHandle statementHandle, CommandBehavior behavior, Boolean needRowid, OciRowidDescriptor& rowidDescriptor, ArrayList& resultParameterOrdinals)
   at System.Data.OracleClient.OracleCommand.ExecuteNonQueryInternal(Boolean needRowid, OciRowidDescriptor& rowidDescriptor)
   at System.Data.OracleClient.OracleCommand.ExecuteNonQuery()
   at MicroFour.StrataFrame.Data.OracleDataSourceItem.UpdateRow(QueryInformation QueryInfo, DataRow RowToUpdate, ConcurrencyExceptionHandler ConcurrencyHandler, AddRowErrorHandler RowErrorHandler, Boolean RecreateCommand)
   at MicroFour.StrataFrame.Data.DbDataSourceItem.UpdateRow(QueryInformation QueryInfo, DataRow RowToUpdate, ConcurrencyExceptionHandler ConcurrencyHandler, AddRowErrorHandler RowErrorHandler)
   at MicroFour.StrataFrame.Data.DataLayer.UpdateDataTableThread(Object ThreadParams)
   at MicroFour.StrataFrame.Data.DataLayer.SaveByForm(DataTable TableToSave, Boolean Transactional, String TransactionKey)
   at MicroFour.StrataFrame.Business.BusinessLayer.SaveByForm(Boolean Transactional, String TransactionKey)
   at MicroFour.StrataFrame.UI.Windows.Forms.BaseForm.Save(Boolean Transactional, String TransactionKey)
   at MicroFour.StrataFrame.UI.Windows.Forms.BaseForm.Save()
   at MicroFour.StrataFrame.UI.Windows.Forms.MaintenanceFormToolStrip.cmdSave_Click(Object sender, EventArgs e)
   at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

StrataFrame Team
S
StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
We updated the debug mode in the version that I'm building to allow for the debugging of INSERT, UPDATE, and DELETE commands.  Before this version, the debug mode on the DbDataSourceItem class only showed SELECT commands.  So, once we get the new build to you, you can call SetDebugOn() on the DbDataSourceItem and you'll be able to see the command that is being sent to the database, and that will give us a clue.
StrataFrame Team
S
StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
The next release will be out before I leave the office today (4 hours or so to go) Smile
Kari Paukku
Kari Paukku
StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)
Group: Forum Members
Posts: 65, Visits: 820
Hi,

what might be the problem here: with the new relaese I still get the same ORA-00936 error mentioned in my previous post. Setting the debug on only shows the select statement - still the error appears when trying to save the changes.

Currently I'm testing this with the simplest possible query - just a couple of columns in the table. With SF samples everything is ok. Might the problem be with the SQL and Oracle? Unfortunately I didn't manage to find the right place to debug the application so that I could see the UPDATE statement.

Any ideas how to resolve this...?

Thank you for all your help,
Kari

StrataFrame Team
S
StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Well, Kari, I'm not sure why the debug isn't working, but I'm building you a maintenance release right now that has some additional debugging information.  You can install this one and just leave it installed, don't worry about going back to the pre-release.

Once you get it installed, it should give you more information in the debug file.  Also, if you can get the version of Oracle that you're running, the table structure (screenshot or CREATE TABLE script would be fine), and the .Designer.vb file for the business object and post those with the output from the debug file, it will go a long way towards helping me to reproduce the error. 

Let me know Smile Thanks

P.S.  I'll post the maintenance install here in a second.

StrataFrame Team
S
StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)StrataFrame Developer (4.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
OK, Kari, here's the maintenance install.  Just let me know what you find.  You'll have to pull the setup exe out of the zip file... the forum won't let you upload executables.

Thanks Smile

Attachments
StrataFrame.zip (154 views, 27.00 MB)
Kari Paukku
Kari Paukku
StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)StrataFrame Novice (91 reputation)
Group: Forum Members
Posts: 65, Visits: 820
Hi Ben,

and thanks for all the help. The new SF showed nicely what was the problem. As I read it,  SF adds a couple of extra "AND"'s into the update's where clause:

UPDATE "RESYS"."EMP" SET "EMP_NAME" = :EMP_NAME WHERE "EMP_NO" = :EMP_NO AND AND AND (("EMP_NAME" = :EMP_NAME_ORG) OR ((:EMP_NAME_ORG IS NULL) AND ("EMP_NAME" IS NULL)))

Here is the SQL for the table


===================================================
-- Table EMP

CREATE TABLE emp
 (
  emp_no                     NUMBER(10) NOT NULL,
  emp_name                   VARCHAR2(50)
 Wink;

-- Constraints for EMP

ALTER TABLE emp
 ADD CONSTRAINT pk_emp PRIMARY KEY (emp_no);

INSERT INTO EMP (EMP_NO, EMP_NAME) VALUES (1,'Bart Simpson');
=====================================================


Attached is the full debug.html file in PDF format.  What I did was 1) retrieve the data => ok, 2) update the EMP_NAME to 'Bart Simpson testing update' => error. I'm using Oracle 10gR2 running on a WinXP machine.

Hope this helps,

Kari

Attachments
debug.pdf (151 views, 7.00 KB)
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search