 |
| Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

November 30th, 2004, 02:06 PM
|
|
Authorized User
|
|
Join Date: Nov 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Error message
Hi,
Can anyone please tell me what this error message means.
Error Type:
Response object, ASP 0104 (0x80070057)
Operation not Allowed
/modify_asset.asp
thank you.
|
|

November 30th, 2004, 02:10 PM
|
|
Friend of Wrox
|
|
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Hi Don,
Can you post the code that causes the error?
Cheers,
Chris
|
|

November 30th, 2004, 02:25 PM
|
|
Authorized User
|
|
Join Date: Nov 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Chris,
Here is the code. Its not so pretty but I know you will be able to figure it out for me.
thanks.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {font-weight: bold}
-->
</style>
</head>
<body>
<%
Dim DB
Set DB = Server.CreateObject ("ADODB.Connection")
DB.Open "driver={MySQL ODBC 3.51 Driver};server=localhost;uid=root;pwd=;database=as setdb"
Dim RS
Set RS = Server.CreateObject ("ADODB.Recordset")
RS.Open "SELECT * FROM asset, branch, location, type, cost", DB
%>
<%
If RS.EOF And RS.BOF Then
Response.Write "There are 0 records."
End If
%>
</p>
<form action="modify_asset.htm" method="get" name="modify" id="modify" >
<table width="" border="1" cellspacing="2" cellpadding="2">
<tr>
<th scope="col"><span class="style1">Asset Number</a> </span></th>
<th scope="col"><span class="style1">Location </a></span></th>
<th scope="col"><span class="style1">Descriptione</a> </span></th>
<th scope="col"><span class="style1">Branch</span></th>
<th scope="col"><span class="style1">Type</span></th>
<th scope="col"><span class="style1">Category</span></th>
<th scope="col"><span class="style1">Cost Center</span></th>
<th scope="col"><span class="style1">Serial Number</span></th>
<th scope="col"><span class="style1">Model</span></th>
<th scope="col"><span class="style1">Purchase Date</span></th>
<th scope="col"><span class="style1">Quantity</span></th>
<th scope="col"><span class="style1">Tax Value</span></th>
<th scope="col"><span class="style1">Insured Value</span></th>
<th scope="col"><span class="style1">Scrap Value</span></th>
</tr>
<tr>
<%
While Not RS.EOF 'makes sure that you don't continue looping past the End of the File
Response.Write("<td width=100><center>" & RS.Fields ("asset_number") & "<center>" & "</td>")
Response.Write("<td width=100>" & RS.Fields ("location_name") & "</td>")
Response.Write("<td width=100>" & RS.Fields ("asset_description") & "</td>")
Response.Write("<td width=100>" & RS.Fields ("branch_name") & "</td>")
Response.Write("<td width=100>" & RS.Fields ("type_name") & "</td>")
Response.Write("<td width=100>" & RS.Fields ("asset_category") & "</td>")
Response.Write("<td width=100>" & RS.Fields ("cost_bearer") & "</td>")
Response.Write("<td width=100>" & RS.Fields ("asset_serial") & "</td>")
Response.Write("<td width=100>" & RS.Fields ("asset_model") & "</td>")
Response.Write("<td width=100>" & RS.Fields ("asset_purchase_date") & "</td>")
Response.Write("<td width=100>" & RS.Fields ("quantity") & "</td>")
Response.Write("<td width=100>" & RS.Fields ("purchase_price") & "</td>")
Response.Write("<td width=100>" & RS.Fields ("asset_tax_value") & "</td>")
Response.Write("<td width=100>" & RS.Fields ("asset_insured_value") & "</td>")
Response.Write("<td width=100>" & RS.Fields ("asset_scrap_value") & "</td>")
%>
</tr>
<%
RS.MoveNext
WEnd
Response.Write("</table>")
RS.Close
DB.close 'Remember to close everything down
%>
</table>
<p> </p>
<p> </p>
</form>
</body>
</html>
|
|

November 30th, 2004, 03:35 PM
|
|
Friend of Wrox
|
|
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Hey Don,
I ran your code against a local database and all seemed fine.
Are any of the fields you are pulling out in the query longtext? - I found in the past that the 3.51 driver and ADO combination returns a field of type vbObject(9) and not vbString(8) when accessing an empty longtext field (even when set as not null).
Any of the following should solve it if this is the problem...
- Use the MyODBC 2.5 driver
- Use a client side cursor on the recordset (RS.CursorLocation = adUseClient before you open it).
- Check the type of the field using something like the following
Code:
Dim myValue
If VarType(rs("message")) = vbObject Then
myValue = ""
Else
myValue = rs("message").Value
End If
Response.Write myValue
HTH,
Chris
|
|

December 1st, 2004, 07:17 AM
|
|
Authorized User
|
|
Join Date: Nov 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi,
This code returns only one record. How can i make it return all data in the database.
Thanks.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {font-weight: bold}
-->
</style>
</head>
<body>
<%
Dim DB
Set DB = Server.CreateObject ("ADODB.Connection")
DB.Open "driver={MySQL ODBC 3.51 Driver};server=localhost;uid=root;pwd=;database=as setdb"
Dim RS
'RS.CursorLocation = adUseClient
Set RS = Server.CreateObject ("ADODB.Recordset")
RS.Open "SELECT * FROM asset, branch, location, type, cost", DB
%>
<%
If RS.EOF And RS.BOF Then
Response.Write "There are 0 records."
End If
%>
</p>
<form action="modify_asset.htm" method="get" name="modify" id="modify" >
<table width="" border="1" cellspacing="2" cellpadding="2">
<tr>
<th scope="col"><span class="style1">Asset Number</a> </span></th>
<th scope="col"><span class="style1">Location </a></span></th>
<th scope="col"><span class="style1">Description</a> </span></th>
<th scope="col"><span class="style1">Branch</span></th>
<th scope="col"><span class="style1">Type</span></th>
<th scope="col"><span class="style1">Category</span></th>
<th scope="col"><span class="style1">Cost Center</span></th>
<th scope="col"><span class="style1">Serial Number</span></th>
<th scope="col"><span class="style1">Model</span></th>
<th scope="col"><span class="style1">Purchase Date</span></th>
<th scope="col"><span class="style1">Quantity</span></th>
<th scope="col"><span class="style1">Purchase Price</span></th>
<th scope="col"><span class="style1">Tax Value</span></th>
<th scope="col"><span class="style1">Insured Value</span></th>
<th scope="col"><span class="style1">Scrap Value</span></th>
</tr>
<tr>
<%
Dim asset_number
If VarType(RS.Fields("asset_number")) = vbObject Then
asset_number = ""
Else
asset_number = RS.Fields("asset_number").Value
End If
Response.Write("<td width=100><center>" & RS.Fields ("asset_number") & "<center>" & "</td>")
Dim location_name
If VarType(RS.Fields("location_name")) = vbObject Then
location_name = ""
Else
location_name = RS.Fields("location_name").Value
End If
Response.Write("<td width=100><center>" & RS.Fields ("location_name") & "<center>" & "</td>")
Dim asset_description
If VarType(RS.Fields("asset_description")) = vbObject Then
asset_description = ""
Else
asset_description = RS.Fields("asset_description").Value
End If
Response.Write("<td width=100><center>" & RS.Fields ("asset_description") & "<center>" & "</td>")
Dim branch_name
If VarType(RS.Fields("branch_name")) = vbObject Then
branch_name = ""
Else
branch_name = RS.Fields("branch_name").Value
End If
Response.Write("<td width=100><center>" & RS.Fields ("branch_name") & "<center>" & "</td>")
Dim type_name
If VarType(RS.Fields("type_name")) = vbObject Then
type_name = ""
Else
type_name = RS.Fields("type_name").Value
End If
Response.Write("<td width=100><center>" & RS.Fields ("type_name") & "<center>" & "</td>")
Dim asset_category
If VarType(RS.Fields("asset_category")) = vbObject Then
asset_category = ""
Else
asset_category = RS.Fields("asset_category").Value
End If
Response.Write("<td width=100><center>" & RS.Fields ("asset_category") & "<center>" & "</td>")
Dim cost_bearer
If VarType(RS.Fields("cost_bearer")) = vbObject Then
cost_bearer = ""
Else
cost_bearer = RS.Fields("cost_bearer").Value
End If
Response.Write("<td width=100><center>" & RS.Fields ("cost_bearer") & "<center>" & "</td>")
Dim asset_serial
If VarType(RS.Fields("asset_serial")) = vbObject Then
asset_serial = ""
Else
asset_serial = RS.Fields("asset_serial").Value
End If
Response.Write("<td width=100><center>" & RS.Fields ("asset_serial") & "<center>" & "</td>")
Dim asset_model
If VarType(RS.Fields("asset_model")) = vbObject Then
asset_model = ""
Else
asset_model = RS.Fields("asset_model").Value
End If
Response.Write("<td width=100><center>" & RS.Fields ("asset_model") & "<center>" & "</td>")
Dim asset_purchase_date
If VarType(RS.Fields("asset_purchase_date")) = vbObject Then
asset_purchase_date = ""
Else
asset_purchase_date = RS.Fields("asset_purchase_date").Value
End If
Response.Write("<td width=100><center>" & RS.Fields ("asset_purchase_date") & "<center>" & "</td>")
Dim quantity
If VarType(RS.Fields("quantity")) = vbObject Then
quantity = ""
Else
quantity = RS.Fields("quantity").Value
End If
Response.Write("<td width=100><center>" & RS.Fields ("quantity") & "<center>" & "</td>")
Dim purchase_price
If VarType(RS.Fields("purchase_price")) = vbObject Then
purchase_price = ""
Else
purchase_price = RS.Fields("purchase_price").Value
End If
Response.Write("<td width=100><center>" & RS.Fields ("purchase_price") & "<center>" & "</td>")
Dim asset_tax_value
If VarType(RS.Fields("asset_tax_value")) = vbObject Then
asset_tax_value = ""
Else
asset_tax_value = RS.Fields("asset_tax_value").Value
End If
Response.Write("<td width=100><center>" & RS.Fields ("asset_tax_value") & "<center>" & "</td>")
Dim asset_insured_value
If VarType(RS.Fields("asset_insured_value")) = vbObject Then
asset_insured_value = ""
Else
asset_insured_value = RS.Fields("asset_insured_value").Value
End If
Response.Write("<td width=100><center>" & RS.Fields ("asset_insured_value") & "<center>" & "</td>")
Dim asset_scrap_value
If VarType(RS.Fields("asset_scrap_value")) = vbObject Then
asset_scrap_value = ""
Else
asset_scrap_value = RS.Fields("asset_scrap_value").Value
End If
Response.Write("<td width=100><center>" & RS.Fields ("asset_scrap_value") & "<center>" & "</td>")
While Not RS.EOF 'makes sure that you don't continue looping past the End of the File
RS.MoveNext 'Move to the next record in the results. Don't forget this!!!
WEnd
Response.Write("</table>")
RS.Close
DB.close 'Remember to close everything down
%>
</tr>
</table>
<p> </p>
<p> </p>
</form>
</body>
</html>
|
|

December 1st, 2004, 07:29 AM
|
|
Friend of Wrox
|
|
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Hi Don,
You need to place the code that displays the records inside your loop.
This section of code
Code:
While Not RS.EOF 'makes sure that you don't continue looping past the End of the File
RS.MoveNext 'Move to the next record in the results. Don't forget this!!!
WEnd
Is moving you to the end of the recordset without doing anything with the data.
Cheers,
Chris
|
|

December 1st, 2004, 08:24 AM
|
|
Authorized User
|
|
Join Date: Nov 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Chris,
Thanks for the reply. I did as you said and I'm still getting this error:
Error Type:
Response object, ASP 0104 (0x80070057)
Operation not Allowed
/modify_asset.asp
Here is the code.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {font-weight: bold}
-->
</style>
</head>
<body>
<%
Dim DB
Set DB = Server.CreateObject ("ADODB.Connection")
DB.Open "driver={MySQL ODBC 3.51 Driver};server=localhost;uid=root;pwd=;database=as setdb"
Dim RS
Set RS = Server.CreateObject ("ADODB.Recordset")
RS.Open "SELECT * FROM asset, branch, location, type, cost", DB
%>
<%
If RS.EOF And RS.BOF Then
Response.Write "There are 0 records."
End If
%>
</p>
<form action="modify_asset.htm" method="get" name="modify" id="modify" >
<table width="" border="1" cellspacing="2" cellpadding="2">
<tr>
<th scope="col"><span class="style1">Asset Number</a> </span></th>
<th scope="col"><span class="style1">Location </a></span></th>
<th scope="col"><span class="style1">Description</a> </span></th>
<th scope="col"><span class="style1">Branch</span></th>
<th scope="col"><span class="style1">Type</span></th>
<th scope="col"><span class="style1">Category</span></th>
<th scope="col"><span class="style1">Cost Center</span></th>
<th scope="col"><span class="style1">Serial Number</span></th>
<th scope="col"><span class="style1">Model</span></th>
<th scope="col"><span class="style1">Purchase Date</span></th>
<th scope="col"><span class="style1">Quantity</span></th>
<th scope="col"><span class="style1">Tax Value</span></th>
<th scope="col"><span class="style1">Insured Value</span></th>
<th scope="col"><span class="style1">Scrap Value</span></th>
</tr>
<tr>
<%
While Not RS.EOF 'makes sure that you don't continue looping past the End of the File
Dim asset_number
If VarType(RS.Fields("asset_number")) = vbObject Then
asset_number = ""
Else
asset_number = RS.Fields("asset_number").Value
End If
Response.Write("<td width=100><center>" & RS.Fields ("asset_number") & "<center>" & "</td>")
Dim location_name
If VarType(RS.Fields("location_name")) = vbObject Then
location_name = ""
Else
location_name = RS.Fields("location_name").Value
End If
Response.Write("<td width=100><center>" & RS.Fields ("location_name") & "<center>" & "</td>")
Dim asset_description
If VarType(RS.Fields("asset_description")) = vbObject Then
asset_description = ""
Else
asset_description = RS.Fields("asset_description").Value
End If
Response.Write("<td width=100><center>" & RS.Fields ("asset_description") & "<center>" & "</td>")
Dim branch_name
If VarType(RS.Fields("branch_name")) = vbObject Then
branch_name = ""
Else
branch_name = RS.Fields("branch_name").Value
End If
Response.Write("<td width=100><center>" & RS.Fields ("branch_name") & "<center>" & "</td>")
Dim type_name
If VarType(RS.Fields("type_name")) = vbObject Then
type_name = ""
Else
type_name = RS.Fields("type_name").Value
End If
Response.Write("<td width=100><center>" & RS.Fields ("type_name") & "<center>" & "</td>")
Dim asset_category
If VarType(RS.Fields("asset_category")) = vbObject Then
asset_category = ""
Else
asset_category = RS.Fields("asset_category").Value
End If
Response.Write("<td width=100><center>" & RS.Fields ("asset_category") & "<center>" & "</td>")
Dim cost_bearer
If VarType(RS.Fields("cost_bearer")) = vbObject Then
cost_bearer = ""
Else
cost_bearer = RS.Fields("cost_bearer").Value
End If
Response.Write("<td width=100><center>" & RS.Fields ("cost_bearer") & "<center>" & "</td>")
Dim asset_serial
If VarType(RS.Fields("asset_serial")) = vbObject Then
asset_serial = ""
Else
asset_serial = RS.Fields("asset_serial").Value
End If
Response.Write("<td width=100><center>" & RS.Fields ("asset_serial") & "<center>" & "</td>")
Dim asset_model
If VarType(RS.Fields("asset_model")) = vbObject Then
asset_model = ""
Else
asset_model = RS.Fields("asset_model").Value
End If
Response.Write("<td width=100><center>" & RS.Fields ("asset_model") & "<center>" & "</td>")
Dim asset_purchase_date
If VarType(RS.Fields("asset_purchase_date")) = vbObject Then
asset_purchase_date = ""
Else
asset_purchase_date = RS.Fields("asset_purchase_date").Value
End If
Response.Write("<td width=100><center>" & RS.Fields ("asset_purchase_date") & "<center>" & "</td>")
Dim quantity
If VarType(RS.Fields("quantity")) = vbObject Then
quantity = ""
Else
quantity = RS.Fields("quantity").Value
End If
Response.Write("<td width=100><center>" & RS.Fields ("quantity") & "<center>" & "</td>")
Dim purchase_price
If VarType(RS.Fields("purchase_price")) = vbObject Then
purchase_price = ""
Else
purchase_price = RS.Fields("purchase_price").Value
End If
Response.Write("<td width=100><center>" & RS.Fields ("purchase_price") & "<center>" & "</td>")
Dim asset_tax_value
If VarType(RS.Fields("asset_tax_value")) = vbObject Then
asset_tax_value = ""
Else
asset_tax_value = RS.Fields("asset_tax_value").Value
End If
Response.Write("<td width=100><center>" & RS.Fields ("asset_tax_value") & "<center>" & "</td>")
Dim asset_insured_value
If VarType(RS.Fields("asset_insured_value")) = vbObject Then
asset_insured_value = ""
Else
asset_insured_value = RS.Fields("asset_insured_value").Value
End If
Response.Write("<td width=100><center>" & RS.Fields ("asset_insured_value") & "<center>" & "</td>")
Dim asset_scrap_value
If VarType(RS.Fields("asset_scrap_value")) = vbObject Then
asset_scrap_value = ""
Else
asset_scrap_value = RS.Fields("asset_scrap_value").Value
End If
Response.Write("<td width=100><center>" & RS.Fields ("asset_scrap_value") & "<center>" & "</td>")
RS.MoveNext 'Move to the next record in the results. Don't forget this!!!
WEnd
Response.Write("</table>")
RS.Close
DB.close 'Remember to close everything down
%>
</table>
<p> </p>
<p> </p>
</form>
</body>
</html>
thanks
|
|

December 1st, 2004, 08:35 AM
|
|
Friend of Wrox
|
|
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Hi Don,
Although you are checking the fields are not vbObject & creating a variable with the appropriate content, you are still accessing the field direct when you are response writing - you need to use the variable holding the value.
For example:
Code:
Dim asset_description
If VarType(RS.Fields("asset_description")) = vbObject Then
asset_description = ""
Else
asset_description = RS.Fields("asset_description").Value
End If
Response.Write("<td width=100><center>" & RS.Fields ("asset_description") & "<center>" & "</td>")
here you would use asset_description and not RS.Fields ("asset_description")
wrapping the check code in a method would make things much easier...
Code:
Response.Write("<td width=100><center>" & GetLongTextValue(RS.Fields("asset_description")) & "<center>" & "</td>")
Function GetLongTextValue(pField)
Dim temp: temp = ""
If VarType(rs("message")) <> vbObject Then
temp = pField.Value
End If
GetLongTextValue = temp
End Function
HTH,
Chris
|
|

December 1st, 2004, 09:42 AM
|
|
Authorized User
|
|
Join Date: Nov 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Chris,
I tried using the variable holding the recordset but still encountered the same error message. It takes so long to execute. Can you direct me to a site where i can download MySQl ODBC 2.5 driver?
Is this code correct?
Response.Write("<td width=100><center>" & GetLongTextValue(RS.Fields("asset_description")) & "<center>" & "</td>")
Function GetLongTextValue(pField)
Dim temp: temp = ""
If VarType(RS("asset_description")) <> vbObject Then
temp = pField.Value
End If
GetLongTextValue = temp
End Function
How does it fit in. Is it before the Dim asset_description or after the if statement?
cheers
|
|

December 1st, 2004, 10:42 AM
|
|
Friend of Wrox
|
|
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Hi Don,
Quote:
quote:
I tried using the variable holding the recordset but still encountered the same error message. It takes so long to execute.
|
The code shouldn't be taking ages to execute unless you are processing lots of records, try it with just a few records to start with - you can use LIMIT in your query to do this, e.g. for 10 records
Code:
"SELECT * FROM asset, branch, location, type, cost LIMIT 10;"
Quote:
quote:
Can you direct me to a site where i can download MySQl ODBC 2.5 driver?
|
You can download it from MySQL http://downloads.mysql.com/archives.php?p=myodbc-2.50
Quote:
quote:
Is this code correct?
Response.Write("<td width=100><center>" & GetLongTextValue(RS.Fields("asset_description")) & "<center>" & "</td>")
Function GetLongTextValue(pField)
Dim temp: temp = ""
If VarType(RS("asset_description")) <> vbObject Then
temp = pField.Value
End If
GetLongTextValue = temp
End Function
How does it fit in. Is it before the Dim asset_description or after the if statement?
|
Sorry, slight typo, the function should be...
Code:
Function GetLongTextValue(pField)
Dim temp: temp = ""
If VarType(pField) <> vbObject Then
temp = pField.Value
End If
GetLongTextValue = temp
End Function
I personally would put the function at the end of the page away from the rest of your code. If you are using it, you don't need the asset_description variable, just use
Code:
Response.Write("<td width=100><center>" & GetLongTextValue(RS.Fields ("asset_description")) & "<center>" & "</td>")
& use similar for other longtext field values
Cheers,
Chris
|
|
 |