Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 ASP error, HELPPPP

views
     
TSgracenalec
post Feb 4 2006, 04:01 AM, updated 20y ago

Getting Started
**
Junior Member
200 posts

Joined: Feb 2005
<%
Dim RS

Set Conn = Server.CreateObject("ADODB.Connection")
Set RS = Server.CreateObject("ADODB.Recordset")

Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("forum.mdb") & ";"
Conn.Open

SQL = "SELECT * FROM profile"
RS.Open SQL, Conn

%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Youth Aloud!Forum</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
#content {
margin-right:1%;
margin-left:1%;
margin-top:5%;
padding-bottom:10px;
background:#fff;
border:2px solid #ffaf38;
text-align:left;
min-width:600px;
}
</style>
</head>

<body>

<table width="650" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFAF38" bgcolor="#FFFFFF" >
<!--DWLayoutTable-->
<tr>
<td height="28" colspan="3" valign="top"><!--DWLayoutEmptyCell-->&nbsp;</td>
</tr>
<tr>
<td height="50" colspan="3" align="center" valign="center"><img src="Exported/profilelogo.gif" width="650" height="50"></td>
</tr>
<tr>
<td width="438" height="29" align="right" valign="center">Search the forum:
</td>
<form name="form1" method="post" action="">
<td width="160" align="right" valign="center">
<input type="text" name="textfield"> </td>
<td width="69" align="center"valign="center">
<input type="submit" name="Submit" value="Search">
</td>
</form>
</tr>
</table>
<table width="650" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" align="center">
<!--DWLayoutTable-->
<tr>
<td width="650" height="300" valign="top" border="2" bordercolor="#FF9900"><div id="content">
<p>Name:
<input name="Name" type="text" value= " <% response.write(RS("Name"))%> ">
</p>
<p>Age:
<input name="Age" type="text" value= " <% response.write(RS("Age"))%> ">
</p>
<p>Gender:
<input name="Gender" type="text" value= " <% response.write(RS("Gender"))%> ">
</p>
<p>Website:
<input name="Website" type="text" value= " <% response.write(RS("Website"))%> ">
</p>
<p> MSN:
<input name="Msn" type="text" value= " <% response.write(RS("Msn"))%> ">
</p>
<p>Yahoo:
<input name="Yahoo" type="text" value= " <% response.write(RS("Yahoo"))%> ">
</p>
<p>Occupation:
<input name="Occupation" type="text" value= " <% response.write(RS("Occupation"))%> ">
</p>
<p>&nbsp; </p>
<form name="form2" method="post" action="updatesuc.asp">
<input type="submit" name="Submit" value="Submit">
</form>
</div></td>
</tr>
</table>
</body>
</html>

<%

RS.Close
Set RS = Nothing
Conn.Close
Set Conn = Nothing

%>


The above code is my code. It was perfectly fine at 1st...After running for a few times, an error occured...i cannot solve it... :'( This happened to my previous code too..I redo my code and this time it's happening again..may i know what is the prob???sad.gif(

Script error detected at line 61.
Source line: response.write(RS("Name"))
Description: Type mismatch: 'Response.Write'

Thanks in advance!
godlike[alex]
post Feb 4 2006, 04:03 AM

New Member
*
Newbie
3 posts

Joined: Jan 2006
From: Bandar Sunway



asp error?
TSgracenalec
post Feb 4 2006, 04:17 AM

Getting Started
**
Junior Member
200 posts

Joined: Feb 2005
umm..i got this error:

Script error detected at line 61.
Source line: response.write(RS("Name"))
Description: Type mismatch: 'Response.Write'


jasonlts
post Feb 4 2006, 04:44 AM

Casual
***
Junior Member
397 posts

Joined: Jan 2003
QUOTE(gracenalec @ Feb 4 2006, 04:17 AM)
umm..i got this error:

Script error detected at line 61.
Source line: response.write(RS("Name"))
Description: Type mismatch: 'Response.Write'
*
Hi, please check whether recordset is returning any records first before Response.Write, then you will need to assign all the values into variable before outputting them ... sample of a few variables and how u check and output

Dim strName
Dim strAge
Dim strGender

If Not (RS.eof or RS.bof) Then
Name = RS("Name").Value
Age = RS("Age").Value
Gender = RS("Gender").Value
End If

........

<%=Response.write strName%>
<%=Response.write strAge%>
<%=Response.write strGender%>



Take note when u retrieve Recordset.Value as this will increase performance.

Regards smile.gif
TSgracenalec
post Feb 4 2006, 09:55 AM

Getting Started
**
Junior Member
200 posts

Joined: Feb 2005
u mean i need to store it in a variable 1st?
eddomlim
post Feb 4 2006, 10:05 PM

Casual
***
Junior Member
358 posts

Joined: Jan 2005


Actually he just want you to make sure that the database had returned something. thus, store it into a variable first then display the variable, if is show nothing that mean your database doesn't return anything
TSgracenalec
post Feb 5 2006, 04:54 PM

Getting Started
**
Junior Member
200 posts

Joined: Feb 2005
ohh...kk..thx

 

Change to:
| Lo-Fi Version
0.0163sec    1.54    5 queries    GZIP Disabled
Time is now: 23rd December 2025 - 06:12 AM