473,406 Members | 2,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

returning text data from SQL Server to ASP.NET page

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
6 2684
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
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

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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Robin Hammond | last post by:
Can anybody tell me why a) when running a stored proc from an asp page to return a recordset the command succeeds if the sp queries an existing table directly, but b) if the stored proc populates...
6
by: Ted Stewart | last post by:
I've got a table with an autogenerated number as it's primary key, which is being accessed by an external .NET app. When the app inserts a new record into the table, is there any way to return the...
4
by: Moe Sizlak | last post by:
Hi There, I am trying to return the value of a listbox control that is included as a user control, I can return the name of the control but I can't access the integer value of the selected item,...
7
by: Aaron | last post by:
Complete code follows. I am new to .NET programming (and programming in general) and I am having a difficult time understanding how to fill a variable in one sub, and then access it from...
4
by: David Lozzi | last post by:
Howdy, I'm using a WYSIWYG editor called TinyMCE. When I edit some text and then save it back to my SQL server using a SQLCommand, all HTML characters are changed to HTML code, i.e. &gt;strong&lt;...
1
by: Curious Trigger | last post by:
Hi there, programming with Visual Studio 2005 and ASP.NET 2.0 I want to open a modal dialog from Default.aspx. I searched the net and many newsgroups but I couldn't find any solution. First I...
23
by: Peter | last post by:
I have a problem with a page show_image.asp that returns a jpg image under Windows XP Pro SP2. The page sets content type as: Response.ContentType = "image/jpg" While this works perfectly fine...
3
by: DMcN | last post by:
Hi, I've set up a form in flash which will send data to a PHP file on my web space, which in return will return the data from the textfields to my e-mail address. I know PHP is enabled in enabled on...
2
by: =?Utf-8?B?UGhpbGlw?= | last post by:
I am attempting to insert a simple record with LinqDataSource from a ListView, however I always get a message saying "....LinqDataSource 'dataSource' has no values to insert. Check that the...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.