Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Resordset cannot write TEXT & CHAR data type problem

Reply
Thread Tools

Resordset cannot write TEXT & CHAR data type problem

 
 
Ang
Guest
Posts: n/a
 
      02-20-2008


Dear all,
I'm a newbie of ASP, and I found that my code cannot output the data
when the DATA type set to TEXT or CHAR, it can only show int & varchar
in MSSQL, what can I do to show TEXT & CHAR data on my page? Many
thanks.

My code is here.

<%
' Use vid to fetch information from server for the video
Sub showMovie(VID)
Dim width, height ' width and height of video
Dim ConnString, SQL, Connection, Recordset

width = "300"
height = "200"
ConnString = "DRIVER={SQL
Server};SERVER=serverName;UID=login;PWD=password;D ATABASE=video"
SQL = "SELECT * FROM table_video WHERE vid = " & VID

' Create an instance of the ADO connection and recordset objects
Set Connection = Server.CreateObject("ADODB.Connection")
Set Recordset = Server.CreateObject("ADODB.Recordset")

Connection.Open ConnString ' Open the connection to the database
Recordset.Open SQL,Connection ' Open the recordset object executing the
SQL statement and return records

' First of all determine whether there are any records
If Recordset.EOF Then
Response.Write("No records returned.")
Else
'show record information
' "description" is TEXT data type, "grade" is CHAR data type
%>
<h1><%=Recordset("title")%></h1>
<p>Category: <%=Recordset("category")%></p>
<p>Time: <%=Recordset("dateadd")%></p>
<p>User: <%=Recordset("uid")%>, Grade: <%=Recordset("grade")%></p>
<embed src="<%=Recordset("filename")%>" width=<%=width%>
height=<%=height%> />
<p>Description:<br /><%=Recordset("description")%></p>
<%
End If

'close the connection and recordset objects to free up resources
Recordset.Close
Set Recordset=nothing
Connection.Close
Set Connection=nothing
End Sub

' vid (video id) numeric checking and validation (if empty)
If Len(Request.Querystring("vid")) > 0 AND
IsNumeric(Request.Querystring("vid")) Then
call showMovie(Request.Querystring("vid"))
Else
Response.write ("Invalid Video ID.") ' error message
End If
%>


*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      02-20-2008
Ang wrote:
> Dear all,
> I'm a newbie of ASP, and I found that my code cannot output the data
> when the DATA type set to TEXT or CHAR, it can only show int & varchar
> in MSSQL, what can I do to show TEXT & CHAR data on my page? Many
> thanks.


My first thought was that you were running into a very old bug caused by
using the obsolete ODBC driver instead of the native SQL Server OLE DB
provider. Sure enough ...
>
> ConnString = "DRIVER={SQL Server}

See http://www.aspfaq.com/show.asp?id=2126
> SQL = "SELECT * FROM table_video WHERE vid = " & VID


See these two articles:

http://www.aspfaq.com/show.asp?id=2096
http://databases.aspfaq.com/database...y-columns.html


--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


 
Reply With Quote
 
 
 
Reply

Thread Tools

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
(const char *cp) and (char *p) are consistent type, (const char **cpp) and (char **pp) are not consistent lovecreatesbeauty C Programming 1 05-09-2006 08:01 AM
Problem- strcat with char and char indexed from char array aldonnelley@gmail.com C++ 3 04-20-2006 07:32 AM
/usr/bin/ld: ../../dist/lib/libjsdombase_s.a(BlockGrouper.o)(.text+0x98): unresolvable relocation against symbol `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostre silverburgh.meryl@gmail.com C++ 3 03-09-2006 12:14 AM
The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value. luna ASP .Net 1 02-13-2004 01:15 PM
the difference between char a[6] and char *p=new char[6] . wwj C++ 7 11-05-2003 12:59 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57