You use the SQL Native Client ODBC Driver in Microsoft SQL Server 2008. If you call the SQLExecute function to execute a prepared statement, no records may be returned. However, if you use the SQL Native Client ODBC Driver in SQL Server 2005 to call the SQLExecute function, records are returned.
This problem may occur because of a bug in the SQL Native Client ODBC Driver in SQL Server 2008. It may occur if you call the SQLBindParameter function before each SQLExecute function. See the "More information" section for more information.
Cumulative update information
The fix for this issue was first released in Cumulative Update 1. For more information about how to obtain this cumulative update package for SQL Server 2008, click the following article number to view the article in the Microsoft Knowledge Base:
956717 Cumulative update package 1 for SQL Server 2008
Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2008 fix release. Microsoft recommends that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
956909 The SQL Server 2008 builds that were released after SQL Server 2008 was released
A supported hotfix is available from Microsoft. However, this hotfix is intended to correct only the problem that is described in this article. Apply this hotfix only to systems that are experiencing this specific problem. This hotfix might receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next software update that contains this hotfix.
If the hotfix is available for download, there is a "Hotfix download available" section at the top of this Knowledge Base article. If this section does not appear, contact Microsoft Customer Service and Support to obtain the hotfix.
Note If additional issues occur or if any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific hotfix. For a complete list of Microsoft Customer Service and Support telephone numbers or to create a separate service request, visit the following Microsoft Web site:
Note The "Hotfix download available" form displays the languages for which the hotfix is available. If you do not see your language, it is because a hotfix is not available for that language.
The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel.
SQL Server 2008, 32-bit editions
SQL Server 2008, 64-bit editions
To work around this problem, call the SQLBindParameter function one time. When you call the SQLBindParameter function, make sure that the following conditions are true:
The ColumnSize argument is of sufficient size.
The Strlen_or_IndPtr argument is set to SQL_NTS.
After the first call to the SQLExecute function is made, the new string value can be copied to the ParameterValuePtr argument.
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
This problem occurs with the SQLBindParameter call. If the previous buffer matches the size of the following value length, a re-prepare of the statement is not issued. In the following example from an ODBC trace, the initial parameter's buffer matches the length of the following new parameter.