Visual Studio .NET Server Explorer generates parameters of incorrect data types (827993)
The information in this article applies to:
- Microsoft Visual Studio .NET (2003), Enterprise Architect Edition
- Microsoft Visual Studio .NET (2003), Enterprise Developer Edition
- Microsoft Visual Studio .NET (2003), Professional Edition
- Microsoft Visual Studio .NET (2003), Academic Edition
- Microsoft Visual Studio .NET (2002), Enterprise Architect Edition
- Microsoft Visual Studio .NET (2002), Enterprise Developer Edition
- Microsoft Visual Studio .NET (2002), Professional Edition
- Microsoft Visual Studio .NET (2002), Academic Edition
- Microsoft ADO.NET (included with the .NET Framework 1.1)
- Microsoft ADO.NET (included with the .NET Framework) 1.0
SYMPTOMSMicrosoft Visual Studio .NET Server Explorer generates SqlCommand objects that contain SqlParameter fields with incorrect data types when one of the following scenarios is true:
- You connect to the Microsoft SQL Server database by using
Visual Studio .NET Server Explorer and then you drag a database table
that contains columns where the data type is text or ntext to the form designer.
- You connect to the SQL Server database by using
Visual Studio .NET Server Explorer and then you drag a stored procedure
that contains parameters where the data type is text or ntext to the form designer.
Note This problem also occurs for columns or parameters where the data
type is image, smallmoney, smalldatetime, or binary. CAUSE Visual Studio .NET Server Explorer uses an OLE DB
provider to connect to a computer that is running SQL Server. The OLE DB provider does not distinguish
between varchar columns and text columns of a data table. Therefore, the size of the parameters
that are generated by Server Explorer is correct, but the data type is not correct.
RESOLUTIONTo resolve the problem, manually change the data type of
the parameters to text or to ntext in the generated code as appropriate for the data type on the
computer that is running SQL Server. Note If you do not manually change the data type of your text and ntext parameters in the generated code, you may receive the error
that is mentioned in the following article:
827366 "Invalid Buffer Received from Client" Error Message in SQL Server Log When You Use SQL Server .NET Provider Classes
STATUS This
behavior is by design.REFERENCES
For more information, click the following article numbers to view the articles in the Microsoft Knowledge Base:
316649
How to use the Server Explorer in Visual Studio .NET and Visual Studio 2005
304959 HOW TO: Use Visual Studio .NET Server Explorer to Access Data
Modification Type: | Minor | Last Reviewed: | 5/2/2006 |
---|
Keywords: | kbSqlClient kbDateTime kbtable kbStoredProc kbprb KB827993 kbAudDeveloper |
---|
|