Name DataType Subtype Length ADOConnection Automation 'Microsoft ActiveX Data Objects 6.0 Library'.Connection ADORecSet Automation 'Microsoft ActiveX Data Objects 6.0 Library'.Recordset ADOStream Automation 'Microsoft ActiveX Data Objects 6.0 Library'.Stream ConnString Text 250 SQLString Text 1000 RecordsAffected Text 1 RSOption Integer FieldValue Text 100 SingleQuote Text 1 IF ISCLEAR(ADOConnection) THEN BEGIN IF NOT CREATE(ADOConnection) THEN BEGIN ERROR(Text001); END; END; IF ISCLEAR(ADORecSet) THEN BEGIN IF NOT CREATE(ADORecSet) THEN BEGIN ERROR(Text002); END; END; DatabaseName := 'NAV_TEST'; ConnString := 'Provider=SQLOLEDB.1;Integrated Security=SSPI;' + 'Persist Security Info=False;Initial Catalog='+ DatabaseName +';Data Source=SQLSERVER'; RecordsAffected := ''; RSOption := 0; SQLString := 'SELECT No_, Description, [Vendor Item No_], [Net Weight], [Global Dimension 2 Code] ' + 'FROM [Cronus Test$Item] ' + 'WHERE (No_ = ' + SingleQuote + ItemNo + SingleQuote + ')'; ADOConnection.ConnectionString(ConnString); ADOConnection.Open; RecordsAffected := ''; RSOption := 0; ADORecSet := ADOConnection.Execute(SQLString,RecordsAffected,RSOption); ADORecSet.MoveFirst; FieldValue := ADORecSet.Fields.Item('Description').Value;
Comments
In my experience this has nothing to do with the string you are passing to ADO. I wouldn't make any sense either.
This error message indicates that NAV is trying to display something (buffer). What it tries to display in the case of an Automation object call is the error returned by same object. In your case, the SQL query failed at some point and ADO is reporting the fact. Usually the error would be displayed as reported, giving the developer/user a hint at where to look for causes. Every now and then however the error message it reports exceeds the 1024 characters limit for some ultimately unimportant reason.
To summarize, don't waste your time looking for errors in NAV. Concentrate on your SQL query/batch.
I know it's probably too late for the original poster, but I hope someone will find this helpful anyway.