Saving business object using Oracle database


Author
Message
winp
winp
StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)
Group: Forum Members
Posts: 4, Visits: 5
I'm trying to add a new record in my business object and try to save it to oracle database table.  I have an error "Missing expression". 

I tried two ways, both of which give me the same error:

1.  I used the Strataframe Maintenance Toolstrip Save method.

2. I have custom code as follows:

            AreaBO areaBO = this.GetAreas(); // This return all records from the database

            DataTable dataTable = areaBO.CurrentDataTable;
            DataColumn[] dataColumn = new DataColumn[1];
            dataColumn[0] = dataTable.Columns["AREAID"];
            dataTable.PrimaryKey = dataColumn;

            DataRow dataRow = null;
            dataRow = dataTable.NewRow();
            dataRow["ID"] = 955;  // hardcoded for now.  it will eventually be dynamic
            dataRow["Location"] = "test";
            dataRow["IsActive"] = 1;
           
            dataTable.Rows.Add(dataRow);

            if (areaBO.IsDirty)
            {
               areaBO.Save();

            }

What am I doing wrong?

Thanks.

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
What am I doing wrong?

Well in this case, diagnosis a "Missing Expression" error is like determine how long a string should be Smile

Turn on data debugging which will write all of the QUERIES and COMMANDs to an HTML file which will let you see exactly what is going back to the server.  There is no way for us to diagnose data related problems without the debug information.

In the Appmain.vb or program.cs file, turn on data debugging after the data source has been created.

MicroFour.StrataFrame.Data.DataBasics.DataSources(0).SetDebugOn("c:\MyDebugOutput.html",True)


winp
winp
StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)StrataFrame Beginner (4 reputation)
Group: Forum Members
Posts: 4, Visits: 5
Trent:

I placed the code as you suggested.  And I received the following in the debug.html.  (I erased the connection string from being displayed for security reason.)  Please advice on why the "Missing Expression" error is occuring on adding records to oracle database.

Thanks.


Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
It looks like your command #3.  There is a "." in front of the NextVal field...I know this would fail on any other ANSI SQL platform, so I assume that this is incorrect for Oracle as well.
Bastian Töpfer
Bastian Töpfer
StrataFrame Novice (56 reputation)StrataFrame Novice (56 reputation)StrataFrame Novice (56 reputation)StrataFrame Novice (56 reputation)StrataFrame Novice (56 reputation)StrataFrame Novice (56 reputation)StrataFrame Novice (56 reputation)StrataFrame Novice (56 reputation)StrataFrame Novice (56 reputation)
Group: Forum Members
Posts: 32, Visits: 107
Hi,

i receive the same error. And it's not me that sends this sql-command. It must be something that  strataframe is sending.

I set BO.OracleSequence to an existing sequence schema.sequencename and the property InsertUsingStoredProcedure is set to false.

Why is the BO not using the specified sequence, but sends rather sends this incorrect command?

Thanks for your help

StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Can you put the data source in Debug and post the results?  You can put the following line of code at the bottom of the SetDataSources() method to put it in debug:

MicroFour.StrataFrame.Data.DataBasics.DataSources(0).SetDebugOn("c:\MyDebugOutput.html",True)

However, as some insight, the data source tries place the sequence name in quotes when executing it.  So, if you specify the full name to the sequence, like Schema.Sequence, then the data source will try to put that in quotes like this: "Schema.Sequence" which will throw it off (since it needs to be "Schema"."Sequence").  So, put it in debug and we'll see what it's trying to produce.

Bastian Töpfer
Bastian Töpfer
StrataFrame Novice (56 reputation)StrataFrame Novice (56 reputation)StrataFrame Novice (56 reputation)StrataFrame Novice (56 reputation)StrataFrame Novice (56 reputation)StrataFrame Novice (56 reputation)StrataFrame Novice (56 reputation)StrataFrame Novice (56 reputation)StrataFrame Novice (56 reputation)
Group: Forum Members
Posts: 32, Visits: 107
Hi,

the Debug file looks like the one posted earlier. I even tried it without the schema -> same result:

Command #: 4
Timestamp: 2007-07-02 16:30:03.171
General Command Settings
Command Type: Text
Object Type: System.Data.OracleClient.OracleCommand
Connection String: Data Source=OPTPRD2;User Id=CUSTRQ;Integrated Security=no;
Transaction: False
Command Settings
CommandText: SELECT .NEXTVAL FROM DUAL
Command Parameters
N/A No parameters are defined

Bastian Töpfer
Bastian Töpfer
StrataFrame Novice (56 reputation)StrataFrame Novice (56 reputation)StrataFrame Novice (56 reputation)StrataFrame Novice (56 reputation)StrataFrame Novice (56 reputation)StrataFrame Novice (56 reputation)StrataFrame Novice (56 reputation)StrataFrame Novice (56 reputation)StrataFrame Novice (56 reputation)
Group: Forum Members
Posts: 32, Visits: 107
Hi,

found the problem. The BO was in a parent/child relationship and the Sequence of the parent BO was empty. So I was looking at the wrong BO to figure out what was wrong Wink Now it works fine. Sorry for the unnecessary post.

StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Hehe, I'm glad you figured it out.  Smile
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