Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2008
    Posts
    3

    Unanswered: Problems with the ntext data type

    Hello everyone,

    I have an SQL table that has a column of the ntext data type. I can query for an individual row within this table and present the single row data just fine, including the ntext.

    However, when I query a selection of rows and try and present them all in a loop the ntext data doesn't display, no error, just no data.

    I was thinking that my problem maybe to do with the amount of data ntext can hold and potential problems with memory when querying for multiple rows.

    I'm using VB within a classic asp file.

    Any suggestions would be appreciated.

    Many thanks

  2. #2
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    If you could show us your code (connection/recordset declaration, instanciation, opening, as well as the code where you loop through the rs) it will help.
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


  3. #3
    Join Date
    Mar 2008
    Posts
    3

    Thank you, here's my code

    Thanks,

    here's the code I'm using, everything works until the loop tries to display the ntext data. All other data columns display perfectly.

    Code:
    'Connection string
    
    Application("databasetitan_cms_ConnectionString") = "DRIVER={SQL Server};SERVER=server;DATABASE=database;UID=userid;PWD=password"
    FrontPage_UrlVars(18) = "databasetitan_ConnectionString"
    Application("databasetitan_ConnectionTimeout") = 15
    Application("databasetitan_CommandTimeout") = 30
    Application("databasetitan_CursorLocation") = 3
    Application("databasetitan_RuntimeUserName") = "user"
    Application("databasetitan_RuntimePassword") = "password"
    
    
    Dim objDCMenu, objRSMenu
    
    connStrfb = Application.Contents("databasetitan_cms_ConnectionString")
    			
    ' Create and establish data connection
    Set objDCMenu = Server.CreateObject("ADODB.Connection")
    objDCMenu.ConnectionTimeout = 15
    objDCMenu.CommandTimeout = 30
    			
    ' Open the database
    objDCMenu.Open connStrfb
    
    ' Create recordset and retrieve values using the open connection
    Set objRSContent = Server.CreateObject("ADODB.Recordset")		
    ' Opening record set with a forward-only cursor (the 0) and in read-only mode (the 1)
    objRSContent.Open "SELECT * FROM tblContent WHERE CourseID = '" & Request.QueryString("course") & "' AND ContentStatus = '1' AND ContentTypeID = '1' ORDER BY ContentOrder", objDCMenu, 0, 1
    
    
    <%
    ' Loop through rows pulling out the content
    objRSContent.MoveFirst
    Do While Not objRSContent.EOF
    content_title = trim(objRSContent.Fields("ContentTitle"))
    content = trim(objRSContent.Fields("Content"))				
    %>
    								
    <!-- Re occuring content -->
    <h2><% Response.Write (content_title) %></h2>
    <p><% Response.Write (content) %></p>
    
    <%         
    objRSContent.MoveNext
    Loop
    %>
    Last edited by loquin; 03-10-08 at 15:16.

  4. #4
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    What do you mean by your reference to

    when I query a selection of rows
    (my accent)
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


  5. #5
    Join Date
    Mar 2008
    Posts
    3

    Recordset

    Thanks,

    I'm talking about querying the database and returning more than 1 row in the results, which is a recordset right?

    If i query the database and return a single row, by searching for the primary key for instance, then there isn't a problem.

    Am I making myself clear?


  6. #6
    Join Date
    Jul 2003
    Location
    Amsterdam, Nederland
    Posts
    450

    Hi, first....

    How are the field below defined in your database ?
    Are they text or numberic ?


    Code:
    AND ContentStatus = '1' AND ContentTypeID = '1'
    If they are nuberic, then ommit the singel cuotes
    same for : CourseID
    Code:
    AND ContentStatus = 1 AND ContentTypeID = 1
    Set a breakpoint On the line of
    Code:
    content = trim(objRSContent.Fields("Content"))
    if the code stops there. Select the words : objRSContent.Fields
    and do a rightclick on it, select quickwatch
    do you see in the tree a list of collections ?
    if so see if you can find : Content
    Greetz Marvels -^.^-
    Developments : VB4 Through .Net; Basic; DOS ; CNC ; Sinclair
    Databases : SQL Server Through 2005; Access 3 Through 2003 ; Oracle 8 & 9.i ;
    OS : Win 3.11 Through XP ; NortonComander ; DOS

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •