Re: ADO.NET 2.0 saving single space to SQL?
- From: Donald Joppa <djoppa@xxxxxxxxxxxxx>
- Date: Wed, 8 Aug 2007 15:24:01 -0700
It is code someone else wrote quite some time ago and all of the string
parameters in the code were identified as char (that's been fixed now). In
the stored procedure and in the database columns those fields are varchar...
"William Vaughn" wrote:
Ah, why are you using Char? There are very few (good) reasons to do so. I.
try to avoid it since space is usually not a consideration. I use it for
FIXED-length text values like the StateCode which has to be two characters
(and only two characters) and the value must exist in the ValidStates table.
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant, Dad, Grandpa
Microsoft MVP
INETA Speaker
www.betav.com
www.betav.com/blog/billva
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------
"Donald Joppa" <djoppa@xxxxxxxxxxxxx> wrote in message
news:44E6DF78-AE72-40CE-A1A5-D456476A0CF5@xxxxxxxxxxxxxxxx
William see my post to my original question. I've been able to reproduce
the
issue in a much simpler scenario. Including c# code, table definition, and
stored procedure definition.
"William Vaughn" wrote:
Let's see the code used to invoke the SP--especially the code that
populates
the Parameters collection. It would be helpful to know what values are
passed to the problem parameter.
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant, Dad, Grandpa
Microsoft MVP
INETA Speaker
www.betav.com
www.betav.com/blog/billva
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no
rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------
"Donald Joppa" <djoppa@xxxxxxxxxxxxx> wrote in message
news:89F148CA-21E6-4FD3-BD97-C0E68B3FE349@xxxxxxxxxxxxxxxx
We're converting from framework 1.1 to 2.0 and something interesting
has
popped up. Fields that are being inserted into the database as a zero
length
string in 1.1 contain a single space when inserted with 2.0 compiled
code.
The code specifies a stored proc to run and set up the parameter
collection.
I've verified in the debugger that in the parameter collection's item
array
entries that I care about contain a zero length string (this is true
for
both
1.1 and 2.0).
SQL is running on a W2K3 box and the instance is SQL2K. I've checked
the
database compatibility level and it is set to 80.
When I capture the insert command via SQL profiler from 1.1 the
parameters
show up as a zero length string (''), but when it comes from 2.0 code
the
same parameters contain a single space (' ').
Anyone have any idea what I'm missing?
- References:
- Re: ADO.NET 2.0 saving single space to SQL?
- From: William Vaughn
- Re: ADO.NET 2.0 saving single space to SQL?
- From: William Vaughn
- Re: ADO.NET 2.0 saving single space to SQL?
- Prev by Date: Re: Strongly Typed DateSets/DataTables and DataReaders
- Next by Date: Re: ADO.NET Transaction
- Previous by thread: Re: ADO.NET 2.0 saving single space to SQL?
- Next by thread: RE: ADO.NET 2.0 saving single space to SQL?
- Index(es):
Relevant Pages
|