- Ramón San Félix Ramón
- SnapDevelop
- Friday, 25 September 2020 10:36 AM UTC
Hi
I'm using PowerScript Dynamic DataStore like this:
//----------------------------------------------PowerBuilder Example ------------------------------------------
long ll_row, ll_rowCount
String ls_sql
String ls_Syntax, ls_error, ls_cliente
DataStore ds_ms
ds_ms = CREATE DataStore
ls_sql = "SELECT empresa, anyo, serie, factura, cliente, importe "+&
"FROM venfac "+&
"WHERE empresa = '"+empresa+"' "+&
"AND anyo = "+anyo+" " +&
"AND serie ='"+serie+"'"
ls_Syntax = SQLCA.SyntaxFROMSQL ( ls_sql, "", ls_error )
ds_ms.Create ( ls_Syntax, ls_error )
ds_ms.SetTransObject ( SQLCA )
ds_ms.Retrieve()
ll_RowCount = ds_ms.RowCount()
for ll_row = 1 to ll_RowCount
ls_cliente = ds_ms.object.cliente[ll_row]
//do something
next
//------------------------------------------------------------------------------------------------------------------
And in Snapdevelop I have seen that with this method I can do the same ...
//----------------------------------------------SnapDevelop Example ------------------------------------------
var sql = @"SELECT empresa, anyo, serie, factura, cliente, importe
FROM venfac
WHERE empresa = @empresa
AND anyo = @anyo
AND serie =@serie;
var ms = _dataContext.SqlExecutor.SelectToStore<DynamicModel>(sql, empresa, anyo, serie, factura);
var rowCount = ms.Count;
for (int row = 0; row < rowCount; row++)
{
string cliente = ms.GetValue<string>(row, "cliente");
//do something
}
//--------------------------------------------------------------------------------------------------------------------------
The problem is that ID marks me that in an obsolete method and I don't know which one I could replace it with. Could you give me an example to make dynamic queries of this style.
Thank you.
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.