Date conversion from ASP.NET to ABL

Posted by gdb390 on 13-Aug-2009 06:52

Hello,

We encounter the following problem.  We have a website written in ASP.Net with in the backend Openedge (.Net open client)

In the asp we create a dataset :

            DataTable ttContext = new DataTable("ttContext");
            DataColumn SessionId = new DataColumn("SessionId");
            DataColumn UsrId = new DataColumn("UsrId");
            DataColumn CompanyId = new DataColumn("CompanyId");
            CompanyId.DataType = System.Type.GetType("System.Int32");
            DataColumn ProcDate = new DataColumn("ProcDate");
            ProcDate.DataType = System.Type.GetType("System.DateTime");

            ttContext.Columns.Add(SessionId);
            ttContext.Columns.Add(UsrId);
            ttContext.Columns.Add(CompanyId);
            ttContext.Columns.Add(ProcDate);

            DataTable ttTableContext = new DataTable("ttTableContext");
            DataColumn TableName = new DataColumn("TableName");
            DataColumn WhereClause = new DataColumn("WhereClause");
            DataColumn SortBy = new DataColumn("SortBy");

            ttTableContext.Columns.Add(TableName);
            ttTableContext.Columns.Add(WhereClause);
            ttTableContext.Columns.Add(SortBy);

            DataRow row = ttTableContext.NewRow();
            row["TableName"] = "test";
            row["WhereClause"] = "referte=testgdb";
            row["SortBy"] = "";
            ttTableContext.Rows.Add(row);

            hdsContext = new DataSet("dsContext");
            hdsContext.Tables.Add(ttContext);
            hdsContext.Tables.Add(ttTableContext);


In the ABL we have the following definition of temp-table and dataset :

define {&1} temp-table ttContext no-undo   
    field SessionId as character
    field UsrId     as character
    field CompanyId as integer
    field ProcDate  as datetime
.

define {&1} temp-table ttTableContext no-undo
    field TableName    as character
    field WhereClause  as character
    field SortBy       as character.

define dataset dsContext        for ttContext, ttTableContext.

In the proxygen there is a procedure that gets the dataset-handle, which is given to another procedure.

In the last, we receive the dataset (no handle).

The error we get is the following :

[09/08/13@12:03:28.219+0200] P-001896 T-003808 1 AS -- (Procedure: 'GetDossier.p' Line:0) The caller's temp-table parameter ttContext does not match to the target temp-table ttContext. (5363)
[09/08/13@12:03:28.219+0200] P-001896 T-003808 1 AS -- (Procedure: 'GetDossier.p' Line:0) Parameters for procedure GetDossier.p (table ttContext and table ttContext) do not match. (12311)

If we leave out the procdate in both asp and ABL, it works OK ?

It seems to have problems with the date coversion

Any ideas?

Gerd

All Replies

Posted by Admin on 13-Aug-2009 07:16

Hi Gerd,

that's easy (one you've found the right info, which took me forever the first time)....

The .NET System.DateTime can be serialized as both an DATE and DATETIME ABL field, so you need to define that in your ASP.NET code before you submit your dataset back to the AppServer. The default is DATE, not DATETIME. Try the following static method:

Progress.Open4GL.ProDataTable.SetColumnProType(ProcDate, Progress.Open4GL.Parameter.PRO_DATETIME);

ProcDate is the reference to your DateTime column. You need to do that with all columns that need to be submitted back as DATETIME temp-table fields.

Mike

Posted by gdb390 on 13-Aug-2009 07:38

Hey Mike,

Your solution was perfect !

thanks a lot !

kind regards

Gerd

This thread is closed