PRB: SQL Server Stores One-Character String with Empty StringLast reviewed: December 8, 1997Article ID: Q177722 |
The information in this article applies to:
SYMPTOMSIn Visual Basic 5.0 using ODBC Direct, when a record is added/edited with a one-character string to a Text field of a SQL Server table, the one- character string is replaced with an empty string.
RESOLUTIONInstead of using AddNew or Edit method, use the SQL statement INSERT INTO or UPDATE directly.
STATUSMicrosoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
MORE INFORMATIONBesides steps to reproduce the behavior, the following sample code provides a workaround by passing the SQL INSERT statement to add a new record. Command1 demonstrates the problem. Command2 provides a workaround.
Task One: Create Test Table and Stored ProcedureFor testing purpose, table TestTbl, is created in the Pubs database. To create a table in SQL Server, select the Pubs database, place the following Create Table T-SQL in the SQL window of ISQL/W and execute it:
CREATE TABLE TestTbl (ID VarChar(20), Comment Text NULL) CREATE UNIQUE INDEX IDIndex ON TestTbl(ID) Task Two: Build the Visual Basic Code
|
Additional query words: sqlserver odbcdirect
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |