If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Text datatype issue

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-07-04, 18:41
sqlboy sqlboy is offline
Registered User
 
Join Date: Mar 2003
Location: Memphis, TN, USA
Posts: 61
Post Text datatype issue

Hi there !
Can anyone let me know, how to store and retrive the text datatype field value in SQL Server 2000 ?

I need to store 1500-2000 character at once, so for that i created textarea tag in html page and made the table field datatype for that textarea is text. What is happening in the table is... all fields value gets uploaded except that Textarea field one ? Why ??

Are there some else way to store the data into it ? Please guide me... I am making the webpages in ASP and SQL SERVER 2000.
Reply With Quote
  #2 (permalink)  
Old 02-08-04, 00:14
gyuan gyuan is offline
Registered User
 
Join Date: Dec 2003
Posts: 454
Please read the post at
Missing Values from specific fields

Do not use TEXT data type if you can use VARCHAR data type instead. VARCHAR can hold maximun to 8000 characters.
Reply With Quote
  #3 (permalink)  
Old 02-08-04, 06:52
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
I agree - from your description you should use a varchar. Using text is a last straw scenario because of performance issues and special handling that is required.
__________________
If you do not have SQL Server Books Online (BOL) installed - please do so. The majority of questions asked in the SQL Server forum could be eliminated if people had access to bol. BOL
Reply With Quote
  #4 (permalink)  
Old 02-08-04, 11:21
sqlboy sqlboy is offline
Registered User
 
Join Date: Mar 2003
Location: Memphis, TN, USA
Posts: 61
Hey.. Thanks for the link and lovely suggestion.

I went for it and replaced Text datatype with field datatype. But .. problem remain the same..

Not able to insert a single character in the respective field ? How come ??
Reply With Quote
  #5 (permalink)  
Old 02-08-04, 15:43
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
You replaced the text datatype with which datatype - did you mean varchar(2500) or whatever your max length is for that field ? List the elements of your table - column name and datatype.
__________________
If you do not have SQL Server Books Online (BOL) installed - please do so. The majority of questions asked in the SQL Server forum could be eliminated if people had access to bol. BOL
Reply With Quote
  #6 (permalink)  
Old 02-08-04, 19:25
gyuan gyuan is offline
Registered User
 
Join Date: Dec 2003
Posts: 454
What is the data type of the field now? Post your code for your insertion of data.
Reply With Quote
  #7 (permalink)  
Old 02-09-04, 00:08
sqlboy sqlboy is offline
Registered User
 
Join Date: Mar 2003
Location: Memphis, TN, USA
Posts: 61
FYI...

CREATE TABLE [event] (
[eventid] [int] IDENTITY (1, 1) NOT NULL ,
[evename] [varchar] (50) NOT NULL,
[evedesc] [varchar] (2000) NOT NULL ,
[evetype] [varchar] (50) NULL
)

ASP Code ::

Dim Conn, Rec, Strsql
Set Conn = Server.CreateObject("ADODB.Connection")
Set Rec = Server.CreateObject("ADODB.Recordset")
Conn.Open "DSN=abc;UID=sqlboy;PWD=abc;DATABASE=abc"
Strsql ="Insert into event values('"& Request.Form("Name" ) &"','"& Request.Form("Descript" ) &"','"& Request.Form("Type" ) &"')"
Set Rec = Conn.Execute(Strsql)
Reply With Quote
  #8 (permalink)  
Old 02-09-04, 00:29
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
Is the rest of the record inserted?? If so I would suspect the your request for Desc is wrong (eg returning null or "").

To test if this is the case replace your requests with hard coded values and see what happens.

Additionaly have you tried putting values into the field using the QA or EM?
Reply With Quote
  #9 (permalink)  
Old 02-09-04, 01:07
sqlboy sqlboy is offline
Registered User
 
Join Date: Mar 2003
Location: Memphis, TN, USA
Posts: 61
Thanks to all of you..

I really did veryvery silly mistakes.. The request for description field is wrong. I forgot to put 's' in the insert statement. The request for evedesc table field is 'Descripts' not 'Descript'

Problem sorted out now.

Thanking you all for your anticipation.
Reply With Quote
  #10 (permalink)  
Old 02-11-04, 19:14
gyuan gyuan is offline
Registered User
 
Join Date: Dec 2003
Posts: 454
If you use

<% Set Rec = Conn.Execute(Strsql) %>

you do not need

<% Set Rec = Server.CreateObject("ADODB.Recordset") %>
Reply With Quote
  #11 (permalink)  
Old 02-11-04, 23:51
sqlboy sqlboy is offline
Registered User
 
Join Date: Mar 2003
Location: Memphis, TN, USA
Posts: 61
Thanks for the suggestion guyan !

Being a kid of Microsoft world, i not aware about the basic fundamental. Why the following syntax used and what actually it did ?? I am in learning stage of ASP and SQL but want to learn everything of the packages.

Thanks indeed !
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On