SQL Server Q&A

As a software engineer, I focus on .NET, especially asp.net, C#, WCF and so on, and I am also very interested in Search Engine Optimization.

Entries Tagged ‘sql server data’

FIX: Parallel Hash Join with Empty Result Set Incorrectly Flows Error Back on Client Connection

Symptoms
If you run a SQL Server Data Manipulation Language (DML) statement from a DB-Library based application against a Microsoft SQL Server 7.0 server, the error handler for the application may incorrectly fire and only report the following error message:

DB-LIBRARY Error 10007, Severity 5:
General SQL Server error: Check messages from the SQL Server.Note that this error message accompanies a wide range of SQL Server errors that are reported back to the client from the server. However, in this scenario the preceding error message is the only error reported and it is not accompanied by any other specific error messages.
Resolution
If a parallel hash join produces an empty result set, internal exception 3602 is used to coordinate the shutdown of worker threads that were created to process the parallel hash plan. The internal 3602 exception is an internal control exception that is used to direct processing flow inside SQL Server and is expected behavior in this case.
However, the fact that it is causing an error to be sent back on the client connection, which in turn causes the DB-Library error handler to fire is not expected behavior.

DSN network library shown as “Other” in ODBC Administrator

Symptoms
When creating a new SQL Server Data Source Name (DSN) using the ODBC API SQLConfigDataSource function, a network library must be specified. If the network library name is in lowercase letters, the Client Configuration dialog box may show it as “Other”.
Resolution
In Control Panel, the Client Configuration dialog box in ODBC Data Source Administrator is case-sensitive. It compares the network library name from the registry to uppercase network library names. See the “More Information” section for information on the registry entries that are affected by SQLConfigDataSource.

How to Use ADO with Visual Basic

Symptoms
Adovb.exe is a self-extracting compressed file containing sample code thatdemonstrates how to use ActiveX Data Objects (ADO) within Visual Basic.
Resolution
The following file is available for download from the Microsoft Download Center:
http://download.microsoft.com/download/vb60pro/demo/1/WIN98/EN-US/AdoVB.EXE(http://download.microsoft.com/download/vb60pro/demo/1/win98/en-us/adovb.exe)For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:
119591?(http://support.microsoft.com/kb/119591/EN-US/) How to Obtain Microsoft Support Files from Online ServicesMicrosoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.
Collapse this tableExpand this table
FileNameSizeDateAdoDemo.mdb332KB7/28/97AdoVB18KB8/5/97AdoVB.vbp1KB8/5/97AdoVbEx6KB7/28/97
What Adovb DemonstratesAdovb demonstrates proper use of output and return parameters (for SQLServer), and opening a parameterized recordset for both a Microsoft Access and SQL Server data sources. Also included is a generic template for error handling with ADO code:

Private Sub cmdTemplate_Click()Dim Conn1 As adodb.ConnectionOn Error GoTo VbError’ Trap (non-ADO) error/exceptions’ Create Connection Object (using early binding)Set Conn1 = new ADODB.ConnectionOn Error GoTo AdoError’ Trap any error/exceptionConn1.ConnectionString = AccessConnectConn1.Open’———————-’ YOUR CODE GOES HERE!’———————-’ Successful ShutdownConn1.CloseDone:’ Miscellaneous (graceful) CleanupOn Error Resume NextSet Conn1 = NothingExit Sub’ ADO Error/Exception HandlerAdoError:’ Save Error Information!ErrNumber = Err.NumberErrSource = Err.SourceErrDescription = Err.DescriptionAdoErrorEx List1, Conn1′ Non-ADO Native error/exception handlerVbError:VbErrorEx List1, ErrNumber, ErrSource, ErrDescriptionGoTo DoneEnd Sub NOTES:When using ADOVB with ADO 2.0 or later, you should remove the Reference to Microsoft OLE DB ActiveX Data Objects 1.0, and set a Reference to the latest version of Microsoft ActiveX Data Objects available.When using ADO 2.0 or later, referencing the OriginalValue property of an ADO Field object will give the following error, if the LockType of the ADO Recordset is Read Only:

Run-time error ‘3251′:The operation requested by the application is not supported by the provider.To avoid this error in ADOVB, comment out or remove the following line of code, in the Click event procedure for cmdAccess in the code window for frmADOVB:

List1.AddItem vbTab & “OriginalValue= ” & rs1.Fields(i).OriginalValue