Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Text Datatype Problem


Message #1 by "Mitchell Adams" <MADAMS@p...> on Wed, 28 Aug 2002 11:50:08 -0400
I've got a column in SQL Server 2000 set as a text datatype with a size of 
16.

I'm trying to insert some data into this column but all that's getting put 
in is the first 16 characters


code:
'Create and Add Parameter
MyCommand.Parameters.Add(New SqlParameter("@Release_Body", SqlDbType.Text, 
16))

'Set the value to that of a textbox's text
MyCommand.Parameters("@Release_Body").Value =3D HTMLEdit.Text




I realize that the column should only be holding a pointer to the rest of 
the text but I don't know how to get to the rest of the text if it is 
indeed working....

Text in row is turned off.

Any help is appreciated.

Thanks

Mitch



Message #2 by Imar Spaanjaars <Imar@S...> on Wed, 28 Aug 2002 18:10:46 +0200
Hi Mitch,

Unlike for instance the Varchar datatype, the length of Text does not refer 
to the actual length. It think (but I am not completely sure) that it's the 
size of the pointer to the actual location of the data. Text types are not 
directly saved within the current row, but saved somewhere else and 
referenced from the row (This is by no means the complete and actual truth, 
but I guess it'll suffice for the moment) Whooops, just read that you said 
the same thing already ;-)

Anyway, the length you pass to the constructor of the parameter expects the 
real length (that is the number of chars) instead of the SQL database / 
pointer length. So, try to pass

HTMLEdit.Text.Length instead of passing 16.

HtH


Imar


At 11:50 AM 8/28/2002 -0400, you wrote:
>I've got a column in SQL Server 2000 set as a text datatype with a size of 16.
>
>I'm trying to insert some data into this column but all that's getting put 
>in is the first 16 characters
>
>
>code:
>'Create and Add Parameter
>MyCommand.Parameters.Add(New SqlParameter("@Release_Body", SqlDbType.Text, 
>16))
>
>'Set the value to that of a textbox's text
>MyCommand.Parameters("@Release_Body").Value = HTMLEdit.Text
>
>
>
>
>I realize that the column should only be holding a pointer to the rest of 
>the text but I don't know how to get to the rest of the text if it is 
>indeed working....
>
>Text in row is turned off.
>
>Any help is appreciated.
>
>Thanks
>
>Mitch



  Return to Index