Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 1 Jahr, 1 Monat
Letzter Beitrag:
vor 1 Jahr, 1 Monat
Beteiligte Autoren:
Danny Lauwers, DW, DerekT

[WD22] data source is not initialized ?

Startbeitrag von Danny Lauwers am 11.07.2017 14:49


When running an MS SQL Query, I get this error when the stored procedure of SQL does not return any dataset. The stored procedure only runs a query and has no select at the end. This is intended, it needs no output !

Then I get the error:

Exception: Linenr. 61 - WL call: Process of 'Method Call' (soSQL.Call), line 61, thread 0 'HReadFirst' function, syntax 3 What happened? System error handling threads. System error handling threads. The data source is not initialized. - If it is a data file, the file was not found in the analysis or it was not described by HDeclare/HDeclareExternal. - If it is a query or a view, the execution may have failed. To retrieve the corresponding error, check the result of HExecuteQuery/HExecuteSQLQuery/HCreateView. Error code: 2901 Level: fatal error WD55 error code: 18 System error code: 8 System error message: Not enough storage is available to process this command. Dump of the error of 'wd220vm.dll' module

This is a general class that is used to call any kind of stored procedure, returning data or not. in WD21, this was functioning correctly !

The code I use to call the SQL is:

bRunResult = HExecuteSQLQuery(m_dsResults,pCon,hQueryWithoutCorrection,m_SQLCommand)

if bRunResult then
IF HReadFirst(m_dsResults) THEN
m_NumberOfRecords = GetNumberOfRecords(m_dsResults)

... The rest of the code

The error is at the HREADFIRST

Is there a way to detect that the data source is not initialized and skip the READFIRST ?
The error is cached in the WHEN EXCEPTION block, but itw only a matter of time before the Windows service just stops ! And always with this error as the latest in my log.

Any suggestions ?



Hello Danny,

HNbRec(Query) to see if there is any data in the query


von DW - am 11.07.2017 15:24

Thanks for the Reply.

But that was my first try and initially the first function after the HExecuteSQLQuery that I already tried. This gives the same error !

Other Idea's ?


von Danny Lauwers - am 12.07.2017 05:12
Hello Danny
like this

bRunResult = HExecuteSQLQuery(m_dsResults,pCon,hQueryWithoutCorrection,m_SQLCommand)

nCount is int = HNbRec(m_dsResults)

If nCount > 0 then

While Not HOut(m_dsResults)

... The rest of the code



von DW - am 12.07.2017 10:15
Hi DW,

Thanks, but the HNbRec gives me the same error then: m_dsResult data source is not initialized.

Very strange :confused:, I would think that if no result set is returned I get a valid but empty (occurrence = 0) data source instead of the data source is not initialized error ?
But of course there are no column names etc... to create an empty datas source !

I currently added an extra flag to indicate if the stored procedure is returning something or not in the WLanguage code that calls the stored procedure. So I can skip the HNbRec and the ReadFirst altogether.

For know that seems to be stable (cross my fingers).

But I would like to have a more general way of detecting if the datasource is initialized/valid or not. (or it is a bug in the library)


von Danny Lauwers - am 12.07.2017 11:38
The error is saying that the query, for one reason or another, did not run successfully - aka Initialize.

Trying any form of access to the query reseult, HReadxxx, HNbRec etc, will therefore always cause a fatal error.
The error is as a result of your trying to read from a non-existent object and it is telling you what happened, or in this case did not happen, and why the read failed.
The issue I suspect is 'bRunResult' which, from what you are saying, is always set True regardless of the success of the query operation.

What you need to know is why the query failed as you are currently trying to overcome the result of the failure and not the cause.
First I would check the query itself as this seems to be the problem - could be a simple mismatch between the content and the analysis or a failed link.

If you can run it in debug place a break at the HExecuteSQLQuery row.
Press F8 and then in the debug table have a look at the error - usually at the bottom of the list.

Alternatively try using IfErrorOccured() after the query execution call and return it using trace(Error(ErrorInfo())).

von DerekT - am 12.07.2017 13:51
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.