Hi Guys.. Got a problem. We use Nav 2009 R2.
We have an interface with an external WMS: the procedures reads a flow map table and, for every flow, call a specific Stored Procedure. If the Flow contains a parameter the function calculate the parameter value and append the parameter accoding to the SQL Parameter Data Type. My function assign: Parameter Name, Data Type, Direction, Size..
My problem is a Datetime Parameter.
When I use the Classic Client everything works fine; in RTC I can not append a Datetime Parameter because I don't know how to assign the specific Data Type. For instance varchar = 22, decimal = 5, Integer = 8 but .. what's the value for datetime??
In Classic client I use the Automation Microsoft ActiveX Data Objects 2.8 Library and the values are different. The following code works:
CASE LRecTableFieldMap."Parameter Data Type" OF
LRecTableFieldMap."Parameter Data Type"::Varchar:
BEGIN
ADOTypeMapValue := 200;
EVALUATE(ParVarchar,LRecParValues."Parameter Value");
lAdoParameter:=lADOCommand.CreateParameter(ADOParam,ADOTypeMapValue,1,ADOParamLenght,ParVarchar);
lADOCommand.Parameters.Append(lAdoParameter);
END;
LRecTableFieldMap."Parameter Data Type"::Integer:
BEGIN
ADOTypeMapValue := 5;
..........
END;
LRecTableFieldMap."Parameter Data Type"::Decimal:
BEGIN
ADOTypeMapValue := 5;
............
END;
LRecTableFieldMap."Parameter Data Type"::DateTime:
BEGIN
ADOTypeMapValue := 7;
........
END;
In RTC I have to use: System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 and I can not find the value to define the datetime parameter data type. I've tried 135, 133, 7.. no one is working.
IF ISSERVICETIER THEN BEGIN
CASE LRecTableFieldMap."Parameter Data Type" OF
LRecTableFieldMap."Parameter Data Type"::Varchar:
BEGIN
EVALUATE(ParVarchar,LRecParValues."Parameter Value");
SQLParameter := SQLParameter.SqlParameter;
SQLParameter.ParameterName := ADOParam;
SQLParameter.SqlDbType := 22;
SQLParameter.Direction := 1;
SQLParameter.Size := ADOParamLenght;
SQLParameter.Value := ParVarchar;
SQLCommand.Parameters.Add(SQLParameter);
END;
LRecTableFieldMap."Parameter Data Type"::Integer:
BEGIN
.......
SQLParameter.SqlDbType := 8;
.......
END;
LRecTableFieldMap."Parameter Data Type"::Decimal:
BEGIN
.....
SQLParameter.SqlDbType := 5;
.....
END;
LRecTableFieldMap."Parameter Data Type"::DateTime:
BEGIN
EVALUATE(ParDatetime,LRecParValues."Parameter Value");
SQLParameter := SQLParameter.SqlParameter;
SQLParameter.ParameterName := ADOParam;
SQLParameter.SqlDbType := 7; // VALUE NOT WORKING
SQLParameter.Direction := 1;
SQLParameter.Size := ADOParamLenght;
SQLParameter.Value := ParDatetime;
SQLCommand.Parameters.Add(SQLParameter);
END;
DOES ANYONE CAN HELP ME?
Thanks a Lot.
0
Comments
There's an example in this post
I'm gonna take that way.
Thanks. :thumbsup: