Dingbat
01-05-2003, 11:24 AM
Hi Guys,
I am trying to create an intranet database with ASP. I am using Frontpage 2002 as my editor and I am having problems with one page.
I have created the .dbf file in Access. I have created the .asp file to read the database together with an. asp file to be able to add to the database. That works.
I have created a modify.asp file to find the entry to modify together with the .asp file that will show the entry with all the field to modify. Those two files work, but now comes the problem. I have created the .asp file to update the record in the database but no matter what I try I fail to be able to update the required record.
The errors that I receive are as follows:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
/myweb/nbt/Modify3.asp, line 38
Page:
POST 143 bytes to /myweb/nbt/Modify3.asp
POST Data:
JobNo=Shaf+100&Date=04%2F01%2F2003&Company=Mine&Contact=Me&JobSpec=Another+Job&Location=Shafesbury&Salary=20000&CVSent=Yes&Action=Update+Record
Below is the code that I am trying to use and is inside the body tags:
<%
strJobNo = Request.Form("JobNo")
strDate = Request.Form("Date")
strCompany = Request.Form("Company")
strContact = Request.Form("Contact")
strJobSpec = Request.Form("JobSpec")
strLocation = Request.Form("Location")
sngSalary = Request.Form("Salary")
strCVSent = Request.Form("CVSent")
If Request.Form("Action") = "Delete Record" Then
strAction = "D"
Else
strAction = "U"
End If
If strAction = "U" Then
SQL = "UPDATE Results SET Results.Results = '" & strResults & "', Results.Date = '" & strDate & "', Results.Company = '" & strCompany & "', Results.Contact = '" & strContact & "', Results.JobSpec = '" & strJobSpec & "', Results.Location = '" & strLocation & "', Results.CVSent = '" & strCVSent & "', Results.Salary = " & sngSalary & " WHERE Results.JobNo = '" & strJobNo & "'"
Else
SQL = "DELETE Results.* FROM Results WHERE Results.JobNo = '" & strJobNo & "'"
End If
Set objConnection = Server.CreateObject("ADODB.Connection")
objConnection.Open "NBT"
Set objCommand = Server.CreateObject("ADODB.Command")
Set RS = Server.CreateObject("ADODB.Recordset")
objCommand.CommandText = SQL
objCommand.CommandType = adCmdText
Set objCommand.ActiveConnection = objConnection
RS.Open objCommand, , adOpenForwardOnly, adLockOptimistic
If strAction = "U" Then
%>
<h2>Record <%= strJobNo %> Updated</h2>
<% Else %>
<h2>Record <%= strJobNo %> Deleted</h2>
<% End If %>
<P><a target="_self" href="../index.html">NBT Home</a></P>
The following statement is also include in the file:
<!--#Include File="Adovbs.inc"-->
Sorry guys if this seems to be long winded but I have been trying to get this sorted now for the last 10 days or so.
I look forward to your assistance
With kind regards,
The Dingbat:confused:
I am trying to create an intranet database with ASP. I am using Frontpage 2002 as my editor and I am having problems with one page.
I have created the .dbf file in Access. I have created the .asp file to read the database together with an. asp file to be able to add to the database. That works.
I have created a modify.asp file to find the entry to modify together with the .asp file that will show the entry with all the field to modify. Those two files work, but now comes the problem. I have created the .asp file to update the record in the database but no matter what I try I fail to be able to update the required record.
The errors that I receive are as follows:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
/myweb/nbt/Modify3.asp, line 38
Page:
POST 143 bytes to /myweb/nbt/Modify3.asp
POST Data:
JobNo=Shaf+100&Date=04%2F01%2F2003&Company=Mine&Contact=Me&JobSpec=Another+Job&Location=Shafesbury&Salary=20000&CVSent=Yes&Action=Update+Record
Below is the code that I am trying to use and is inside the body tags:
<%
strJobNo = Request.Form("JobNo")
strDate = Request.Form("Date")
strCompany = Request.Form("Company")
strContact = Request.Form("Contact")
strJobSpec = Request.Form("JobSpec")
strLocation = Request.Form("Location")
sngSalary = Request.Form("Salary")
strCVSent = Request.Form("CVSent")
If Request.Form("Action") = "Delete Record" Then
strAction = "D"
Else
strAction = "U"
End If
If strAction = "U" Then
SQL = "UPDATE Results SET Results.Results = '" & strResults & "', Results.Date = '" & strDate & "', Results.Company = '" & strCompany & "', Results.Contact = '" & strContact & "', Results.JobSpec = '" & strJobSpec & "', Results.Location = '" & strLocation & "', Results.CVSent = '" & strCVSent & "', Results.Salary = " & sngSalary & " WHERE Results.JobNo = '" & strJobNo & "'"
Else
SQL = "DELETE Results.* FROM Results WHERE Results.JobNo = '" & strJobNo & "'"
End If
Set objConnection = Server.CreateObject("ADODB.Connection")
objConnection.Open "NBT"
Set objCommand = Server.CreateObject("ADODB.Command")
Set RS = Server.CreateObject("ADODB.Recordset")
objCommand.CommandText = SQL
objCommand.CommandType = adCmdText
Set objCommand.ActiveConnection = objConnection
RS.Open objCommand, , adOpenForwardOnly, adLockOptimistic
If strAction = "U" Then
%>
<h2>Record <%= strJobNo %> Updated</h2>
<% Else %>
<h2>Record <%= strJobNo %> Deleted</h2>
<% End If %>
<P><a target="_self" href="../index.html">NBT Home</a></P>
The following statement is also include in the file:
<!--#Include File="Adovbs.inc"-->
Sorry guys if this seems to be long winded but I have been trying to get this sorted now for the last 10 days or so.
I look forward to your assistance
With kind regards,
The Dingbat:confused: