A
Ang
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;DATABASE=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
%>
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;DATABASE=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
%>