![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Oct 2005
Posts: 7
Rep Power: 0
![]() |
Can't figure out why this is not working
First off here is the error i am getting this error when i click the submit button, which i want to delete a record.
Microsoft OLE DB Provider for ODBC Drivers error '80040e14' [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name 'ff15008'. /admin/carerase1.asp, line 36 What I want the pages to do is display all records in the table each record would have a seperate line where there would be a check box next to it, so you can check as many as you want and then hit the submit button. When you hit the submit button it should then delete the records that you checked. then it would transer to another page erasecar1 which would say "you have deleted record number " " from the database.........and so on. code for carerase.asp <%@ LANGUAGE=VBScript %>
<!--#include virtual="database.asp"-->
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Erase Cars</title>
</head>
<body>
<%
id = Session("ID")
if id = "" then
response.redirect "../default.asp"
end if
%>
<h1 align="center">Erase Cars</h1>
<form method="POST" action="carerase1.asp">
<div align="center">
<center>
<p></p>
</center>
</div>
<div align="center">
<center>
<table border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" id="AutoNumber1">
<tr>
<td>Delete</td>
<td>Car ID</td>
<td>Year</td>
<td>Make</td>
<td>Model</td>
<td>Date</td>
</tr>
<tr>
<td><hr></td>
<td><hr></td>
<td><hr></td>
<td><hr></td>
<td><hr></td>
<td><hr></td>
</tr>
<%
dim i, c, t
i = 0
c = "C"
t = "T"
Set UserRecordset = Server.CreateObject("ADODB.Recordset")
SQL = "SELECT * FROM North_Yard ORDER BY Date, Year"
dim DatabaseConnection
DBConnOpen DatabaseConnection
UserRecordset.Open SQL, DatabaseConnection
Set objCarID = UserRecordset("Car_ID")
Set objYear = UserRecordset("Year")
Set objMake = UserRecordset("Make")
Set objModel = UserRecordset("Model")
Set objDate = UserRecordset("Date")
If UserRecordset.EOF then
Response.Write "<p>There are no cars found in the database. "
Response.Write "Please contact your system administrator."
else
Do until UserRecordset.EOF
i = i + 1
%>
<tr><td><input type="checkbox" name="<%= c & i%>" value="ON"></td>
<td><!-- --><input type="text" name="<%= t & i%>" size="20" value="<%= objCarID%> " readonly></td>
<td><%= objYear%></td>
<td><%= objMake%></td><td><%= objModel%></td><td><%= objDate%></td></tr>
<%
UserRecordset.MoveNext
loop
end if
Session("Rec") = i
%>
</table>
</center>
</div>
<p align="center"><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>
<p align="center"><a href="adminmenu.asp">Admin Menu</a></p>
</body>
</html><%@ LANGUAGE=VBScript %>
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Add car to the database</title>
</head>
<body>
<%
dim wid(30)
dim wsyear(30)
dim wsmake(30)
dim wsmodel(30)
dim wsdate(30)
dim num
DIM aoConnObj
Dim sCONNECTION_STRING
sCONNECTION_STRING = "Driver={SQL Server};Server=db1.omnera.net;Database=upull;UID=rparts;PWD=alternator"
Function DBConnOpen(ByRef aoConnObj)
On Error Resume Next
Set aoConnObj = Server.CreateObject("ADODB.Connection")
aoConnObj.CursorLocation = 3
Call aoConnObj.Open(sCONNECTION_STRING)
If Err Then
Err.Clear
Set aoConnObj = Nothing
DBConnOpen = False
Else
DBConnOpen = True
End If
End Function
dim DatabaseConnection
DBConnOpen DatabaseConnection
Set CommandObject= Server.CreateObject("ADODB.Command")
Set CommandObject.ActiveConnection = DatabaseConnection
SQL = "INSERT INTO North_Yard (Car_ID,[Year], Make, Model, [Date]) VALUES (?,?,?,?,?)"
CommandObject.CommandText = SQL
CommandObject.Prepared = True
CommandObject.Parameters.Append CommandObject.CreateParameter("Car_ID",200, ,255)
CommandObject.Parameters.Append CommandObject.CreateParameter("[Year]",200, ,255)
CommandObject.Parameters.Append CommandObject.CreateParameter("Make",200, ,255)
CommandObject.Parameters.Append CommandObject.CreateParameter("Model",200, ,255 )
CommandObject.Parameters.Append CommandObject.CreateParameter("[Date]",200, ,255 )
num = 0
for i = 1 to 29
if Request.Form.Item("Y" & i) <> "" then
num = num + 1
wid(num) = Request.Form.item("ID" & i)
wsyear(num) = Request.Form.Item("Y" & i)
wsmake(num) = Request.Form.Item("M" & i)
wsmodel(num) = Request.Form.Item("C" & i)
wsdate(num) = Request.Form.Item("Date" & i)
end if
next
if num = 0 then
wsorder = "n"
else
Response.Write "<p align='center'>Car Added to the Database<p>"
Response.Write "<center><table border='1'><tr><td> </td><td>Car_ID</td><td>Year</td><td>Make</td><td>"
Response.Write "Model</td><td>Date</td></tr>"
for i = 1 to num
CommandObject("Car_ID") =wid(i)
CommandObject("[Year]") = wsyear(i)
CommandObject("Make") = wsmake(i)
CommandObject("Model") = wsmodel(i)
CommandObject("[Date]") = wsdate(i)
CommandObject.Execute
Response.Write "<tr><td>Car " & i & "</td><td>" & wid(i) & "<td>" & wsyear(i) & "</td><td>" & wsmake(i)
Response.Write "</td><td>" & wsmodel(i) & "</td><td>" & wsdate(i) & "</td></tr>"
next
end if
Response.Write "</table><p>"
Public Function DBConnClose(ByRef aoConnObj)
If IsObject(aoConnObj) Then
If aoConnObj.State = adStateOpen Then
aoConnObj.Close
DBConnClose = True
End If
Set aoConnObj = Nothing
End If
End Function
%>
<a href="adminmenu.asp">Admin Menu</a>
</body>
</html> |
|
|
|
|
|
#2 |
|
Newbie
Join Date: Oct 2005
Posts: 7
Rep Power: 0
![]() |
the database i am connecting to is a mssql database
|
|
|
|
|
|
#3 |
|
Newbie
Join Date: Oct 2005
Posts: 7
Rep Power: 0
![]() |
i figured it out
|
|
|
|
|
|
#4 |
|
Man Bear Pig Hunter
Join Date: Jul 2005
Location: NorCal, USA
Posts: 292
Rep Power: 4
![]() |
good to hear
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|