PDA

View Full Version : Help with update pages



kirstybandm
27 Nov 2006, 12:38 PM
I really hope someone can help I am very stuck.

I've built a website that use .asp pages and a Microsoft access database. Everything worked perfectly when I tested the site locally. When I uploaded it to the live server things were different.
I went to the web host's control panel and created a DSN and pasted it into all of my .asp pages. Now all the pages that only display content from the database work but I have an admin section that doesn't. I can't get my pages to add, update, or delete any records. Instead I get this error:

ADODB.Command error '800a0bb9'

Arguments are of the wrong type, are out of acceptable range, or are in co***ict with one another.

/NewSite/UserNew.asp, line 113

My webhost says that the problem is not with the dsn its with the way its referenced so won't help and I simply don't know much .asp. These pages were created in Dreamweaver.

This is my complete code for the Add a New User page:
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/Swift.asp" -->
<%
' *** Edit Operations: declare variables

Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd

Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId

Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i

MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables

If (CStr(Request("MM_insert")) = "New") Then

MM_editConnection = oConn
MM_editTable = "User_Accounts"
MM_editRedirectUrl = "Added.htm"
MM_fieldsStr = "UserName|value|Password|value|AccessLevel|value"
MM_columnsStr = "User_Name|',none,''|Pass_word|',none,''|Access_Level|none,none,NULL"

' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")

' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
Next

' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If

End If
%>
<%
' *** Insert Record: construct a sql insert statement and execute it

Dim MM_tableValues
Dim MM_dbValues

If (CStr(Request("MM_insert")) <> "") Then

' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),",")
MM_delim = MM_typeArray(0)
If (MM_delim = "none") Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none") Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none") Then MM_emptyVal = ""
If (MM_formVal = "") Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "") Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'") Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End If
MM_tableValues = MM_tableValues & MM_columns(MM_i)
MM_dbValues = MM_dbValues & MM_formVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"

If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close

If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl)
End If
End If

End If
%>
<%
Dim rsUserAccount__MMColParam
rsUserAccount__MMColParam = "1"
If (Request.QueryString("ID") <> "") Then
rsUserAccount__MMColParam = Request.QueryString("ID")
End If
%>
<%
Dim rsUserAccount
Dim rsUserAccount_numRows

Set oConn = Createobject("AdoDB.Connection")
oConn.Open "FILEDSN=" & server.mappath("/Data/swift.dsn")
'oConn.Open "FILEDSN=" & server.mappath("/Data/swift.mdb.dsn")

Set rsUserAccount = Server.CreateObject("ADODB.Recordset")
rsUserAccount.ActiveConnection = oConn
rsUserAccount.Source = "SELECT * FROM User_Accounts WHERE ID = " + Replace(rsUserAccount__MMColParam, "'", "''") + ""
rsUserAccount.CursorType = 0
rsUserAccount.CursorLocation = 2
rsUserAccount.LockType = 3
rsUserAccount.Open()

rsUserAccount_numRows = 0
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/MainTemplate.dwt" codeOutsideHTMLIsLocked="false" -->

<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Swift Credit Services</title>
<!-- InstanceEndEditable -->
<meta name="keywords" content="Swift, Credit, Services, distress, civil enforcement, debt recovery, status reporting, process serving, investigations, repossessions, warrant, Bailiffs, Eviction, " />
<meta name="description" content="For over thirty years Swift Credit Services Limited has served government, local authorities, the legal profession, financial institutions and commerce. A family owned business, Swift is a firm believer in, and promoter of traditional values such as professionalism, quality of service, value for money and personal service." />

<style type="text/css" media="all">
/*<![CDATA[*/
@import url(Template.css);
/*]]>*/
</style>

<script src="x.js" type="text/javascript">
</script>
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
</head>

<body>

<div id="wrapper">

<div id="masthead">

<div id="logo">

</div>
</div>

<div id="navContainer">

<div id="Topnavigation">
<ul>
<li><a href="index.html" class="">Home</a></li>
<li><a href="AboutUs.htm">About us</a></li>
<li><a href="Careers.asp">Careers</a></li>
<li><a href="ContactUs.htm">Contact</a></li>
<li><a href="News.asp">News</a></li>
<li><a href="#" class="" onclick="MM_openBrWindow('http://www.swiftcreditservices.co.uk','Login','toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=y es,resizable=yes,width=700,height=500')">Client Login</a></li>
<li><a href="#" class="Last" onclick="MM_openBrWindow('http://www.swiftcreditsecure.com/index.php','Payment','toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,w idth=700,height=500')">Pay Online</a></li>
</ul>
</div>
</div>

<div id="leftNavBox">
<div id="Leftnavigation">
<ul>
<li><a href="Anchors.htm#Arrests">Arrests</a></li>
<li><a href="Anchors.htm#Certified">Certified Balliffs</a></li>
<li><a href="Anchors.htm#Property">Commercial Property Services</a></li>
<li><a href="Anchors.htm#CompanySearches">Company Searches</a></li>
<li><a href="Anchors.htm#Secretarial">Company Secretarial Services</a></li>
<li><a href="Anchors.htm#CreditControl">Credit Control and Debt Recovery</a></li>
<li><a href="Anchors.htm#Travellers">Eviction of Travellers and Squatters</a></li>
<li><a href="Anchors.htm#Process">Process Serving</a></li>
<li><a href="Anchors.htm#Status">Status Enquiry Agents</a></li>
<li><a href="Anchors.htm#Tracings">Tracing and Investigation</a></li>
</ul>
</div>
</div>

<!-- InstanceBeginEditable name="Content" -->
<div id="content">
<div id="rightContent">

</div>
<h1>Create New User</h1>
<form ACTION="<%=MM_editAction%>" METHOD="POST" name="New" id="New" >
<p class="Login">User Name: <input name="UserName" type="text" size="60" maxlength="50" />
</p>
<p class="Login">Password: <input name="Password" type="text" size="61" maxlength="50" />
</p>
<p class="Login">User Access Level: <input name="AccessLevel" type="text" size="54" maxlength="50" />
</p>
<p class="Login">
<input type="submit" class="formbutton" value="Add" /></p>



<input type="hidden" name="MM_insert" value="New">
</form>

<p>&nbsp;</p>
<p><a href="AdministratorArea.htm" class="ArrowBack">back to Administration Area</a></p>

</div>
<!-- InstanceEndEditable -->


<!-- InstanceBeginEditable name="rightContent" -->

<!-- InstanceEndEditable -->


<!-- InstanceBeginEditable name="SpanBothContent" -->
<div id="contentLogos">

</div>
<!-- InstanceEndEditable -->

<div id="footer">
<ul>
<li>Head Office Merthyr Tydfil</li>
<li class="blue">0870 000 6222</li>
<li>Regional Office Chester</li>
<li class="blue">01244 853857</li>
<li>Regional Office Milton Keynes</li>
<li class="blue">0870 000 6207</li></ul>
</div>
</div>

</body>

<!-- InstanceEnd --></html>
<%
rsUserAccount.Close()
Set rsUserAccount = Nothing
%>


I hope someone can help.
Thanks