Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Help!!!! Problem bringing back nText!

Author  Topic 

Ayeidea
Starting Member

17 Posts

Posted - 2002-02-16 : 22:38:18
Hi,
Im doing a shopping cart site and on the site i have some products with 4000 characters of text and others with just 500. I set the field in the table to nText and called it P_Long. The problem is when i bring back text from the select statement I get this error. Can anyone help, What am i doing wrong!

quote:
Microsoft OLE DB Provider for ODBC Drivers error '80040e21'

Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.

/amGolf/Clubs/Antique.Clubs/Antique.Irons/ProductPage.asp, line 126



Here is the RS code:

quote:
Dim ListProdRS__mmParam
ListProdRS__mmParam = "1"
if (Request.Querystring("PID") <> "") then ListProdRS__mmParam = Request.Querystring("PID")

set ListProdRS = Server.CreateObject("ADODB.Recordset")
ListProdRS.ActiveConnection = MM_AmGolfConn_STRING
ListProdRS.Source = "SELECT Products_tbl.PID, Cat_tbl.Cat_name, Products_tbl.P_Name, Products_tbl.P_Man, Products_tbl.P_Long, Products_tbl.P_Pic,Products_tbl.P_weight,Products_tbl.P_Price,Products_tbl.P_Qty, Products_tbl.P_Show, Products_tbl.P_Date FROM Products_tbl LEFT JOIN Cat_tbl ON Products_tbl.P_CID = Cat_tbl.CatID WHERE (((Products_tbl.PID)='" + Replace(ListProdRS__mmParam, "'", "''") + "') AND ((Products_tbl.P_Show)=1)) ORDER BY Products_tbl.P_Man,Products_tbl.P_Date;"
ListProdRS.CursorType = 0
ListProdRS.CursorLocation = 2
ListProdRS.LockType = 3
ListProdRS.Open()
ListProdRS_numRows = 0

Here is line 126:
quote:
<%=(ListProdRS.Fields.Item("P_Long").Value)%>


robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-02-16 : 22:50:50
If you have a text/ntext or image column in SQL Server and you're using ADO to retrieve it, it MUST be the last column in the SELECT list. You also cannot have more than one text column in the SELECT list using ADO.

You should seriously reconsider having ntext in your table, it will cause you more grief than it's worth.

Edited by - robvolk on 02/16/2002 22:52:09
Go to Top of Page

Ayeidea
Starting Member

17 Posts

Posted - 2002-02-16 : 22:53:34
What would be a better solution. Thanks by the way for the suggestion. Im new to sqlserver.
john

Go to Top of Page

smccreadie
Aged Yak Warrior

505 Posts

Posted - 2002-02-17 : 06:23:51
A varchar field holds up to 8,000 characters. A nvarchar field can do 4,000.

Will one of these work?

Go to Top of Page

Doug G
Constraint Violating Yak Guru

331 Posts

Posted - 2002-02-17 : 12:52:01
You need to retrieve text columns in your code in the same order you have them in your select statement. You only get one shot at the data, so if you need to reference the data more than once in your code you should immediately copy the text from your recordset to a local variable.

I don't have any problems with multiple text columns in a select in an asp page. In fact this forum code uses multiple text columns in one select in some places.


======
Doug G
======
Go to Top of Page

Ayeidea
Starting Member

17 Posts

Posted - 2002-02-17 : 22:47:11
Ok changed it to varchar and its working fine. But a new qurrious problem arros. When i cut and past some text into the field directly in sql server 7 enterprise, it will not allow me to cut and past it in. i have to put in line by line, then it stops allowing me to write in more lines, and I even extend the field range but it still wont allow me to paste it in? any ideas on this?
john

ps. thanks for your help.

Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2002-02-17 : 22:52:05
Hi

Enterprise manager is NOT designed to be a data entry tool. It pretty much is a crap data entry tool

If you are building an ASP site, then build an ASP interface for data entry, or for a really quick and dirty way, use an Access Project. This will let you use access as a front end for SQL Server. Then you can hack together an Accesss form.

Damian
Go to Top of Page

Ayeidea
Starting Member

17 Posts

Posted - 2002-02-17 : 23:03:51
Cool, I was just using it to plug info into the site for testing. Reguraly the site will have an admin section for that, but i was freeking out cause i figured if enterpise manager did that, then i might have the same problem when i write the code!
thanks so much.
john

Go to Top of Page
   

- Advertisement -