Re: ASP Help Again!

by "Matthew Ohlman" <matthew(at)ohlman.com>

 Date:  Wed, 31 Jul 2002 08:31:53 -0500
 To:  "Joellyn Whitehead" <JWhitehead(at)ilchildcare.org>,
"HWG Basics" <HWG-Basics(at)hwg.org>
 References:  ilchildcare
  todo: View Thread, Original
OK. Here we go. First, thanks to all those who responded. I have tried alot
of things to try and get this to work. I will show you the most recent code,
and then tell you what I updated from my original.
(I excluded adding the dots, I don't think it will matter though since I
have to send messages to the list plain text)
---CODE STARTS---

<center>Enter your Information</center><br /><br />
<form method="post" action="sign.asp">
<table width="40" align="center">
  <tr><td><font face="arial"
color="orange">Name:*&nbsp;&nbsp;&nbsp;</font><input type="text" name="name"
size="30"></td></tr>
    <tr><td><font face="arial"
color="orange">Email:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><input
type="text" name="email" size="30"></td></tr>
   <tr><td><font face="arial" color="orange">Website Address:</font><input
type="text" name="website" size="40"></td></tr>
  <tr><td><font face="arial" color="orange">Website Name:</font><input
type="text" name="webName" size="40"></td></tr>
 <tr><td><font face="arial" color="orange">Comments:</font><textarea
name="comments" cols="30" rows="3" maxchar="255"></textarea></td></tr>
<input type="hidden" name="date1" value="dte"><input type="hidden" name="id"
value="next">
<tr><td><center><input type="submit" value="Submit">
<input type="hidden" name="flag" value=1>&nbsp;&nbsp;<input
type="reset"></center></td></tr>
</table>
<%
End If
 If Flag = 1 then
   If IsEmpty(request.form("Name")) or request.form("Name")="" then
          response.write "<center><font face='arial' size='4'><b>Please
enter your name</b></font></center>"
          response.write "<form>"
          response.write "<input type='button' value='Fix It'
onclick=history.back()></form>"
          response.end
  Else
Name = request.form("name")
 End If

   Email = request.form("email")
   WebName = request.form("webname")
   WebSite = request.form("website")
   Date1 = request.form("date1")
   ID = request.form("id")
   Comments = request.form("comments")
   Commets = Replace(comments, Chr(35), "")
   Comments = Replace(comments, VbCrlf, "<br>")
  Flag = Request.form("Flag")
%>

<center>Here is the information you entered. Please verify that it is
correct, and then push Continue.<br />'
Ot to change it, please hit change<br /><br />

<b><font face="arial" size="2" color="orange">Name:</b><%=Name%><br
/></font>
<b><font face="arial" size="2" color="orange">Email:</b><%=Email%><br
/></font>
<b><font face="arial" size="2" color="orange">Web
Address:</b><%=WebSite%><br /></font>
<b><font face="arial" size="2" color="orange">Web Site
Name:</b><%=WebName%><br /></font>
<b><font face="arial" size="2" color="orange">Comments:<b><%=Comments%><br
/></font>
<form action="sign.asp" method="post">
<input type="hidden" name="name" value="<%=Name%>">
<input type="hidden" name="Email" value="<%=Email%>">
<input type="hidden" name="WebAddress" value="<%=WebSite%>">
<input type="hidden" name="WebName" value="<%=WebName%>">
<input type="hidden" name="Comments" value="<%=Comments%>">
<input type="hidden" name="date1" value="<%=date1%>">
<input type="hidden" name="id" value="<%=id%>">
<input type="hidden" name="Flag" value=2>
<input type="submit" value="Continue"><input type="button" value="Change"
onClick="history.go(-1)"></form>
<%
End If
 If Flag = 2 Then
 Name= request.form("name")
 Name = replace(Name, "'" , "'")
 Name = Replace(Name, Chr(34), "'")
 Email=request.form("email")
 WebName = request.form("WebName")
 WebAddress = request.form("WebSite")
   Date1 = request.form("date1")
   ID = request.form("id")
   flag = request.form("flag")
 Comments = request.form("comments")
 Comments = Replace(Comments, "'", "'")

set conn = server.createobject("adodb.connection")
 DSNtemp = "DRIVER={Microsoft Access Driver (*.mdb)};"
 DSNtemp = dsntemp & "DBQ=" & server.mappath("guestbook.mdb")
 conn.open DSNTemp

SQLstmt = "INSERT INTO GB ('Name,Email,WebName,Website,Comments, id, date1,
flag')"
SQLstmt = SQLstmt & " VALUES ("
SQLstmt = SQLstmt & "'" & Name & "' , "
SQLstmt = SQLstmt & "'" & Email & "' , "
SQLstmt = SQLstmt & "'" & WebName & "' , "
SQLstmt = SQLstmt & "'" & Website & "' , "
SQLstmt = SQLstmt & "'" & Comments & "' , "
SQLstmt = SQLstmt & "'" & id & "' , "
SQLstmt = SQLstmt & "'" & date1 & "' , "
SQLstmt = SQLstmt & "'" & flag & "' , "
SQLstmt = SQLstmt & ")"

Set RS = conn.execute(SQLstmt)

 If errNumber>0 Then
  response.write "Error Number:" & err.number & "<br />"
  response.write "Error Description:" & err.description & "<br />"
  response.write "Error Help Path:" & err.helppath & "<br />"
  response.write "Native Error:" & err.nativeerror & "<br />"
  response.write "Error Source:" & err.source & "<br />"
  response.write "Error SQLState:" & err.sqlstate & "<br />"
End If
  If conn.errors.count>0 Then
   response.write"Sorry, These Database Errors Occured" & "<br />"
   response.write SQLstmt & "<br />"
for counter=0 to conn.errors.count
response.write "Error #" & conn.errors(counter).number & "<br />"
response.write "Error Description" & conn.errors(counter).description & "<br
/>"
  Next
   Else

response.write "<font face='arial' size='3'><center><img src='gb.gif'
alt='The Guestbook' /><br />"
response.write "<b>Suscess!</b><br />"
response.write "Thank You! Your entry was succesfully added to the
guestbook. Click <a href='guestbook.asp'>Here</a> to return to the
Guestbook"
 End If
End If
set conn = nothing
%.>
----------END CODE-------------

OK. I added the hidden date1 ID, and flag fields  to see if that would help
but it didnt. Then I added a FLAG field to the DB itself but still no! I
have absolutley no idea what is wrong. If someone would like me to send them
a copy of the databse itself I would be glad to. Thanks for any help!!

Matthew


----- Original Message -----
From: "Joellyn Whitehead" <JWhitehead(at)ilchildcare.org>
To: "'Matthew Ohlman'" <matthew(at)ohlman.com>; "HWG Basics"
<HWG-Basics(at)hwg.org>
Sent: Wednesday, July 31, 2002 8:15 AM
Subject: RE: ASP Help Again!


> What's the code for the submit page (especially the SQL)?
>
> -----Original Message-----
> From: Matthew Ohlman [mailto:matthew(at)ohlman.com]
> Sent: Tuesday, July 30, 2002 10:06 PM
> To: HWG Basics
> Subject: ASP Help Again!
>
>
> Hi again. I again have an ASP or database problem with my guestbook. I
> sucsefully got the view page to work, but now I am having trouble with the
> submit page. I get the following error:
>
> Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
>
> [Microsoft][ODBC Microsoft Access Driver] Number of query values and
> destination fields are not the same.
>
> /sign.asp, line 81
>
> I really have no clue to what is wrong. If someone could point me in the
> right direction of what is wrong I would appreciate it. I have made sure
> that I am using the right names of the data items in the DB. Though I'm
not
> even sure that has anything to do with it.
>
> Thanks again, Matthew
>

HTML: hwg-basics mailing list archives, maintained by Webmasters @ IWA