By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,112 Members | 1,619 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,112 IT Pros & Developers. It's quick & easy.

returning text data from SQL Server to ASP.NET page

P: n/a
I'm trying to set up an asp.net (vb.net) that will allow a user to
insert/update a bio/profile. I wanted to create a SQL Server 2000 table that
includes their contact info and bio info. However, I'm not getting SQL
Server to accept more than about two paragraphs of info. I've tried the
datatypes of ntext and nvar char to no success. I'm presuming most people
will be cutting and pasting from a Word document also.

Does anyone have any suggestions re: the datatype issue and also the
formating of the text when it comes out of SQL Server and into the ASP.NET
page. I would imagine this is a fairly common thing to do, but I haven't
been able to find anything in the documentation about it.

Also, I up to other ways also. Like is there a way to have them upload a
text file and pull the info out of the text file and somehow present it on
the ASP.NET page?

Any help or direction would be greatly appreciated.

Rod
Nov 18 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
You can use a varchar(8000) which is considerably more than 2 paragraphs.
You might check how you're passing the parameter to your stored procedure.
If you don't specify how many characters the variable is, it defaults to
255.

parmListName.Direction = ParameterDirection.Output
parmTitle = cmd.Parameters.Add("@title", SqlDbType.VarChar)
parmTitle.Size = 100

Uploading a file is also pretty easy in .NET. Using the IDE, it's an HTML
control: "File Field".
Once it's uploaded to a temp directory, you can read the file in and
manipulate it and display it.

Chip

"Rod Snyder" <ro*@rcsnyder.com> wrote in message
news:Of**************@tk2msftngp13.phx.gbl...
I'm trying to set up an asp.net (vb.net) that will allow a user to
insert/update a bio/profile. I wanted to create a SQL Server 2000 table that includes their contact info and bio info. However, I'm not getting SQL
Server to accept more than about two paragraphs of info. I've tried the
datatypes of ntext and nvar char to no success. I'm presuming most people
will be cutting and pasting from a Word document also.

Does anyone have any suggestions re: the datatype issue and also the
formating of the text when it comes out of SQL Server and into the ASP.NET
page. I would imagine this is a fairly common thing to do, but I haven't
been able to find anything in the documentation about it.

Also, I up to other ways also. Like is there a way to have them upload a
text file and pull the info out of the text file and somehow present it on
the ASP.NET page?

Any help or direction would be greatly appreciated.

Rod

Nov 18 '05 #2

P: n/a
ntext is the most optimised way to store large amout of textual information.
if you are using ntext then you wont be able to use stored procs output
parameter to return the value.
instead you will have to return a SELECT Query which can be read using a
DataReader or a DataSet.

plus max length for a data row in a particular table is limited to 8080. so
unless all other columns have total capacity of 80 bytes it would chop of
the rest.

--
Regards,
HD
Once a Geek.... Always a Geek
"Rod Snyder" <ro*@rcsnyder.com> wrote in message
news:Of**************@tk2msftngp13.phx.gbl...
I'm trying to set up an asp.net (vb.net) that will allow a user to
insert/update a bio/profile. I wanted to create a SQL Server 2000 table
that
includes their contact info and bio info. However, I'm not getting SQL
Server to accept more than about two paragraphs of info. I've tried the
datatypes of ntext and nvar char to no success. I'm presuming most people
will be cutting and pasting from a Word document also.

Does anyone have any suggestions re: the datatype issue and also the
formating of the text when it comes out of SQL Server and into the ASP.NET
page. I would imagine this is a fairly common thing to do, but I haven't
been able to find anything in the documentation about it.

Also, I up to other ways also. Like is there a way to have them upload a
text file and pull the info out of the text file and somehow present it on
the ASP.NET page?

Any help or direction would be greatly appreciated.

Rod

Nov 18 '05 #3

P: n/a

Chip:
Do you have any more detail on the "reading the file in". What should
I look for in the documentation to be able to read it in (into what) and
how to present it on an asp.net page.
Rod
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #4

P: n/a
Hi Rod,
Thanks for posting in the community! My name is Steven, and I'll be
assisting you on this issue.
From your description, you want to let user input large paragraphs of text
and then stored into SQLServer
DataBase. Also, you'd like to retrieve the data out later and display in a
certain ASP.NET web page, yes?
If there is anything I misunderstood, please feel free to let me know.

As for this problem, here is my suggestions on it:
First , about the data type use to store the file content. I think the
text/ntext data type is the proper one since text/ntext type are particular
designed for store large amount of text information. It is highly optimised
dependent on the actual data's size.
If you use char/varchar, you need to definitly specify the size which'll
cause the waste of the space.
As for the proper way to store the text content from web page into DataBase
and also retrieve it out and display, I think you may use the DataReader
Component in ADO.NET as Hermit suggested. The DataReader can help execute a
certain insert or query statement. Then you just pass the text content as
the input parameter of the insert statement and when retrieving it out, you
just query the certain text/ntext type column and output it to a certain
label on the ASP.NET web page. Do you think so?

In addtion, instead of using text type, you could also first convert the
text content into byte arrays and then store it as binary large object
(BLOB) data to Microsoft SQL Server. Just like store other binary datas
such as images or rich documents...
Here is a KB article on: #HOW TO: Read and Write BLOB Data by Using ADO.NET
Through ASP.NET
http://support.microsoft.com/?id=326502
You may have a view to see whether it helps you.

Further more, I 've also searched some kb articles which have discussed on
some know issues or limitations on using Text/ntext type as input or output
param of store procedure with ADO.NET, you may also have a check to see
whether they'll help you:

#PRB: Stored Procedure with Text (BLOB) Input Returns Null Output
http://support.microsoft.com/?id=178445

#PRB: Text Output Parameter Empty with Unicode Build
http://support.microsoft.com/?id=216196

Please consider the above suggestions. If you have any questions, please
feel free to post here.
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #5

P: n/a
Hi Rod,
Have you had a chance to tried out the suggestions in my last reply or
have you got any progress on this problem?
If you need any further help, please feel free to post here.
Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #6

P: n/a
Hi Rod,
In the former reply, I said that "The DataReader can help execute a certain
insert or query statement.", I'm sorry that I've made a mistake, it should
be "The SqlCommand or OleCommand object can help execute a certain sql
statement". And as for the "how to read in a file from ASP.NET web page"
you mentioned, do you mean how to upload a file to serverside via a ASP.NET
web page? If so, here is a kb article focus on how to upload a file to
serverside in ASP.NET web application:

#HOW TO: Upload a File to a Web Server in ASP.NET by Using Visual Basic .NET
http://support.microsoft.com/?id=323245

#HOW TO: Upload a File to a Web Server in ASP.NET by Using Visual C# .NET
http://support.microsoft.com/?id=323246

Please check out the above items. In the mean time, if you have any
questions or got any progress on this issue, please feel free to post here.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Nov 18 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.