on 04-07-2017 2:56 PM
Hi, I´m trying to retrieve the date and the time from a database field, but I only get the time (my code below), the result in the SQL manager si '2017-04-06 19:38:05.000' but my recordset is '2017-04-06 00:00:00.000'
SAPbobsCOM.Recordset oRecordSet = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
string sSql = "SELECT MAX([U_FecAct]) AS [U_FecAct] FROM [@TDGIMON]";
oRecordSet.DoQuery(sSql);
if (!oRecordSet.EoF)
{
DateTime dt = oRecordSet.Fields.Item("U_FecAct").Value;
}
Hi Sebastian,
It is by design. If you notice, SBO system columns keep date and time in 2 different columns.
You may have update your UDF using SQL queries. This is not supported by SBO.
If you want to follow SBO rules, create 2 columns for it, one of type date, another of type time.
If you keep it under current design, you can get the time by Casting the column to string first.
Regads
Edy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Try to TypeCast your Variable 'dt'. The below code is working for me:
SAPbobsCOM.Recordset oRecSet = (SAPbobsCOM.Recordset)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
string str = "Select DocDate from ORDR";
oRecSet.DoQuery(str);
DateTime dt = Convert.ToDateTime(oRecSet.Fields.Item("DocDate").Value);
Kind regards,
ANKIT CHAUHAN
SAP SME Support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am really sorry and I completely misread it...
As far as I have tested it now, there seems to be no possibility to get it directly in the Recordset. I am afraid that it could be because of design behavior.
Still, I think there might be something in SQL Queries or .NET that could help you to get it done in easy way.
Kind regards,
ANKIT CHAUHAN
SAP SME Support
User | Count |
---|---|
98 | |
12 | |
10 | |
6 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.