AdoCon_l 'Microsoft ActiveX Data Objects 2.8 Library'.Connection // Automation AdoRecordSet_l 'Microsoft ActiveX Data Objects Recordset 2.8 Library'.Recordset // Automation AdoRecordSetConn_l 'Microsoft ActiveX Data Objects 2.8 Library'.Recordset // Automation AdoStream_l 'Microsoft ActiveX Data Objects 2.8 Library'.Stream // Automation AdoField_l 'Microsoft ActiveX Data Objects 2.8 Library'.Field //Automation RecClient_l //Record //Customer
CREATE(AdoCon_l); CREATE(AdoRecordSet_l); AdoCon_l.ConnectionString := 'Provider=SQLOLEDB.1;Data Source=QUALISH;Initial Catalog=aigle;User Id=username;Password=pwd'; AdoCon_l.Open; AdoRecordSetConn_l := AdoCon_l.Execute('SELECT * FROM MyView WHERE BoolNew=1','',0); AdoRecordSet_l.Open('SELECT * FROM MyView WHERE BoolNew=1',AdoCon_l,3,1); //3 for CursorType=adOpenStatic and 1 for LockType = adOpenKeyset IF NOT AdoRecordSet_l.EOF THEN REPEAT IF AdoRecordSet_l.Fields.Item('numClient').Value.ISTEXT THEN BEGIN CREATE(AdoStream_l); AdoStream_l.Open; AdoField_l := AdoRecordSet_l.Fields.Item('numClient')) AdoStream_l.WriteText(AdoField_l.Value); AdoStream_l.Position := 0; IF EVALUATE(ReturnValue_R,AdoStream_l.ReadText) THEN RecClient_l."No." := AdoStream_l.ReadText; END; IF AdoRecordSet_l.Fields.Item('name').Value.ISTEXT THEN BEGIN CREATE(AdoStream_l); AdoStream_l.Open; AdoField_l := AdoRecordSet_l.Fields.Item('name')) AdoStream_l.WriteText(AdoField_l.Value); AdoStream_l.Position := 0; IF EVALUATE(ReturnValue_R,AdoStream_l.ReadText) THEN RecClient_l.Name := AdoStream_l.ReadText; END; IF AdoRecordSet_l.Fields.Item('amount').Value.ISDECIMAL THEN BEGIN CREATE(AdoStream_l); AdoStream_l.Open; AdoField_l := AdoRecordSet_l.Fields.Item('amount')) AdoStream_l.WriteText(AdoField_l.Value); AdoStream_l.Position := 0; IF EVALUATE(ReturnValue_R,AdoStream_l.ReadText) THEN RecClient_l.Amount := AdoStream_l.ReadText; END; RecClient_l.INSERT; AdoRecordSet_l.MoveNext; UNTIL AdoRecordSet_l.EOF; AdoRecordSet_l.Close; AdoCon_l.Close; CLEAR(AdoRecordSet_l); CLEAR(AdoCon_l);
Answers
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
If my source is a text field everything is ok but if my source field is e.g. decimal the use of "...item(xy).value;" produces this error!?
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
...item.ActualSize gives me the right number for every text field. But for all other fields like DECIMAL and NUMERIC it gives me "19"!?
And still ...item.Value produces the above mentioned error!
If I take a look into the database (with e.g. dBASE) my DECIMAL field has a length of 3!
Can anyone help please?
adNumeric
131
Indicates an exact numeric value with a fixed precision and scale (DBTYPE_NUMERIC).
Is Navision unable to handle this data type??
Try using FLOAT datatype in SQL. I had the same problem las year, and I solved it changing SQL table datatype
Regards
Although I could not change the source datatype I added a CAST to FLOAT to my SQL SELECT statement.