473,727 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2710
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.Di rection = ParameterDirect ion.Output
parmTitle = cmd.Parameters. Add("@title", SqlDbType.VarCh ar)
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.c om> wrote in message
news:Of******** ******@tk2msftn gp13.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.c om> wrote in message
news:Of******** ******@tk2msftn gp13.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
3148
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 results into a different table, temporary table, global temp table, or table variable, then queries one of these, the asp page reports that the recordset object is closed. If using a table, I have set grant, select, update, delete permissions for...
6
1977
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 ID? Using a "SELECT FROM table WHERE (repeat of inserted data) ORDER BY " and selecting the largest ID would probably work, but that's extremely clunky. I'm new to databases in general, but this should be a common enough problem that...
4
2458
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, what do I need to do in order to return the "option value" of the control? Moe !--- returned value of the control
7
2195
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 another. I have tried declaring them as shared, public, friend, etc and I always get an error stating that something is not valid on a local variable declaration. For example, in the following code for Sub DataGrid_Select, I have CurrentID and...
4
3030
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; instead of <strong> and so on. Is this a problem with the editor or something else? Does .Net convert it? I had to disable page validate request because of the tags, is there more? Thanks,
1
7656
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 tried using two aspx pages with standard controls and all those post-backs and their attributes OnClientClick. Since this didn't work, i reduced it to a default.aspx page opening a pure html-page as a modal dialog.
23
5929
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 on most machines, on some machines I experience this problem: When loading the page a window pops up that asks if I want to open the document show_page.asp. When I click "Open" Interdev pops up and opens up a
3
1372
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 my web server because I tested it and it's OK. Please can anyone check my PHP script below to see if I am missing something that would cause my e-mails not to be returned (I'm new to PHP). I posted last week and I had to many parameters but I...
2
3360
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 'values' dictionary contains values...." I am using a ListView with a DataSourceID of a LinqDataSource. When a new row icon is clicked....the ListView properly enters into the InsertItemTemplate....however when the ImageButton with a CommandName of...
0
8891
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9406
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9120
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6703
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4521
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4786
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3228
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2639
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2158
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.