Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-30-2005, 07:19 PM   PM User | #1
codefantom
New Coder

 
Join Date: Jul 2005
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
codefantom is an unknown quantity at this point
Problem with form! HELP Please!!!

Here is the code
[code]
<script type="text/javascript" language="JavaScript1.2" src="../assets/creditform.js"></script>
<%
connection = "Data Source=" & Server.Mappath("../_private/credit.mdb") & ";Provider=Microsoft.Jet.OLEDB.4.0;"
Set objconn = Server.CreateObject("ADODB.Connection")
objconn.Open connection
%>
<%

set session("dataID") = request.form("dataID")
on error resume next

dim dat_id
dim new_name
dim new_desc
dim new_disputes
dim FormSubmit

dat_id = Request.form("dataID")
new_name = Request.form("name")
new_desc = Request.form("desc")
new_disputes = Request.form("disputes")
submit = Request.form("Postback")

function main()

If FormSubmit <> "" Then
with response
If dat_id = "" Then
.Write "<body onLoad='error0()>" & vbcrlf

End If

If Not IsNumeric(dat_id) Then
.Write "<body onLoad='error1()>" & vbcrlf

End If






updateDataSQL = "UPDATE datas SET dat_name = '" & new_name & "'," _
& " dat_description = '" & new_desc & "'" _
& " WHERE dat_id = " & dat_id
objconn.Execute updateDataSQL

deleteSQL = "DELETE FROM mydisputes WHERE dat_id = " & dat_id

.Write "<HR>DEBUG deleteSQL: " & deleteSQL & "<HR>"

objconn.Execute deleteSQL ' DO IT


updateDisputesSQL = "INSERT INTO mydisputes (dat_id, dispute_id) " _
& " SELECT " & dat_id & ", id FROM disputes " _
& " WHERE id IN (" & new_disputes & ")"

.Write "<HR>DEBUG updateDisputesSQL: " & updateDisputesSQL & "<HR>"

objconn.Execute updateDisputesSQL ' DO IT


End If


getMainSQL = "SELECT * FROM datas WHERE dat_id = " & dat_id
Set RS = objconn.Execute( getMainSQL )
If RS.EOF Then
.Write "<body onLoad='error2()'>" & vbcrlf

End If
' show the basic info:
%>

<FORM name="customerContents" action="test.asp?submitted=true"
method="post">
DATA ID: <input type="text" name="dataID"
value="<%=session.contents("dataID")%>" maxlength="20" size="20"><br/>
NAME: <INPUT Name="name" Value="<%=RS("dat_name")%>"><br/>
DESCRIPTION: <INPUT Name="desc" Value="<%=RS("dat_description")%>"><br/>
DISPUTES:<br/>
<%



disputeSQL = "Select D.ID, IIF(ISNULL(M.dispute_id),'','CHECKED') AS CHK,
D.U_Disputes " _
& " FROM disputes AS D LEFT JOIN mydisputes AS M " _
& " ON ( D.id = M.dispute_id AND M.dat_id = " & dat_id & ") " _
& " ORDER BY D.u_disputes"

.Write "<HR>DEBUG disputeSQL: " & disputeSQL & "<HR>"

Set RS = objconn.Execute(SQL)
count = 0
CONST CBS_PER_LINE = 2 ' if you have room, make it 3 checkboxes per line
Do Until RS.EOF
%>
<INPUT TYPE="CHECKBOX" Name="disputes" VALUE="<%=RS("id")%>" <%=RS("chk")%>
> <%=RS("U_Disputes")%>
<%
x = x + 1
If x MOD CBS_PER_LINE = 0 Then .Write "<br/>"
RS.MoveNext
Loop
end if
end with
end function

RS.close
set RS = nothing
objconn.close
set objconn = nothing
set disputeSQL =nothing
set updateDataSQL = nothing
set deleteSQL = nothing
set updateDisputesSQL = nothing
set SQL = nothing
set CBS_PER_LINE = nothing
set dat_id = nothing
set new_name = nothing
set new_desc = nothing
set new_disputes = nothing

%>
<div align="center">
<INPUT Type="Submit" Name="Postback" Value="Submit changes"></div>
</FORM>
[code]

And this is the error:
Microsoft VBScript compilation (0x800A0405)
Expected 'With'
/myweb/ducredit/includes/test.asp, line 69, column 4
End If


Any ideas???
codefantom is offline   Reply With Quote
Old 08-30-2005, 07:38 PM   PM User | #2
nikkiH
Senior Coder

 
nikkiH's Avatar
 
Join Date: Jun 2005
Location: Near Chicago, IL, USA
Posts: 1,973
Thanks: 1
Thanked 32 Times in 31 Posts
nikkiH is on a distinguished road
That didn't format very well.
Exactly which line is 69?
You probably forgot an End-something somewhere.
__________________

If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
Bored? Visit
http://www.kaelisspace.com/
nikkiH is offline   Reply With Quote
Old 08-30-2005, 07:41 PM   PM User | #3
nikkiH
Senior Coder

 
nikkiH's Avatar
 
Join Date: Jun 2005
Location: Near Chicago, IL, USA
Posts: 1,973
Thanks: 1
Thanked 32 Times in 31 Posts
nikkiH is on a distinguished road
Code:
If FormSubmit <> "" Then
   With response
      If dat_id = "" Then
         .Write "<body onLoad='error0()>" & vbcrlf
      End If
      If Not IsNumeric(dat_id) Then
         .Write "<body onLoad='error1()>" & vbcrlf
      End If
      
      updateDataSQL = "UPDATE datas SET dat_name = '" & new_name & "'," _
      & " dat_description = '" & new_desc & "'" _
      & " WHERE dat_id = " & dat_id
      objconn.Execute updateDataSQL

      deleteSQL = "DELETE FROM mydisputes WHERE dat_id = " & dat_id
      .Write "<HR>DEBUG deleteSQL: " & deleteSQL & "<HR>"

      objconn.Execute deleteSQL ' DO IT
      updateDisputesSQL = "INSERT INTO mydisputes (dat_id, dispute_id) " _
      & " SELECT " & dat_id & ", id FROM disputes " _
      & " WHERE id IN (" & new_disputes & ")"

      .Write "<HR>DEBUG updateDisputesSQL: " & updateDisputesSQL & "<HR>"

      objconn.Execute updateDisputesSQL ' DO IT

End If << ==  here is the problem, now that I see formattting.
Got an End If with no If!!
If that was supposed to be there, you had to put End With first. Nesting must be done properly.
__________________

If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
Bored? Visit
http://www.kaelisspace.com/
nikkiH is offline   Reply With Quote
Old 08-30-2005, 07:56 PM   PM User | #4
codefantom
New Coder

 
Join Date: Jul 2005
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
codefantom is an unknown quantity at this point
Where would the "End With" or the "If" statements go

Thanks
codefantom is offline   Reply With Quote
Old 08-30-2005, 08:10 PM   PM User | #5
neocool00
Regular Coder

 
Join Date: Sep 2004
Posts: 152
Thanks: 0
Thanked 0 Times in 0 Posts
neocool00 is an unknown quantity at this point
Line in red.
Code:
objconn.Execute updateDisputesSQL ' DO IT
End With
End If
neocool00 is offline   Reply With Quote
Old 08-30-2005, 08:46 PM   PM User | #6
codefantom
New Coder

 
Join Date: Jul 2005
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
codefantom is an unknown quantity at this point
Now I get this error message

Microsoft VBScript compilation (0x800A0409)
Unterminated string constant
/myweb/ducredit/includes/test.asp, line 91, column 73
disputeSQL = "Select D.ID, IIF(ISNULL(M.dispute_id),'','CHECKED') AS CHK,
codefantom is offline   Reply With Quote
Old 08-30-2005, 09:29 PM   PM User | #7
nikkiH
Senior Coder

 
nikkiH's Avatar
 
Join Date: Jun 2005
Location: Near Chicago, IL, USA
Posts: 1,973
Thanks: 1
Thanked 32 Times in 31 Posts
nikkiH is on a distinguished road
Well, it's an unterminated string.
Terminate it.
(hint: that line isn't like your other lines...it's missing something...)

You have to help yourself a LITTLE.
__________________

If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
Bored? Visit
http://www.kaelisspace.com/
nikkiH is offline   Reply With Quote
Old 08-30-2005, 09:33 PM   PM User | #8
Bullschmidt
Regular Coder

 
Join Date: Aug 2002
Location: USA
Posts: 478
Thanks: 0
Thanked 2 Times in 2 Posts
Bullschmidt is an unknown quantity at this point
codefantom:
Quote:
disputeSQL = "Select D.ID, IIF(ISNULL(M.dispute_id),'','CHECKED') AS CHK,
nikkiH:
Quote:
(hint: that line isn't like your other lines...it's missing something...)
And we can end up QUOTING you on that, right?
__________________
J. Paul Schmidt
www.Bullschmidt.com - Freelance Web and Database Developer
www.Bullschmidt.com/DevTip.asp - Classic ASP Design Tips

Last edited by Bullschmidt; 08-30-2005 at 09:36 PM..
Bullschmidt is offline   Reply With Quote
Old 08-30-2005, 09:35 PM   PM User | #9
nikkiH
Senior Coder

 
nikkiH's Avatar
 
Join Date: Jun 2005
Location: Near Chicago, IL, USA
Posts: 1,973
Thanks: 1
Thanked 32 Times in 31 Posts
nikkiH is on a distinguished road
Um...well, you just did, eh?

(did I miss something...I HAVE been a bit on the slow side today...?)
__________________

If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
Bored? Visit
http://www.kaelisspace.com/
nikkiH is offline   Reply With Quote
Old 08-30-2005, 09:37 PM   PM User | #10
Bullschmidt
Regular Coder

 
Join Date: Aug 2002
Location: USA
Posts: 478
Thanks: 0
Thanked 2 Times in 2 Posts
Bullschmidt is an unknown quantity at this point
I just enjoyed reading your hint and added slightly to it...
__________________
J. Paul Schmidt
www.Bullschmidt.com - Freelance Web and Database Developer
www.Bullschmidt.com/DevTip.asp - Classic ASP Design Tips
Bullschmidt is offline   Reply With Quote
Old 08-30-2005, 09:46 PM   PM User | #11
nikkiH
Senior Coder

 
nikkiH's Avatar
 
Join Date: Jun 2005
Location: Near Chicago, IL, USA
Posts: 1,973
Thanks: 1
Thanked 32 Times in 31 Posts
nikkiH is on a distinguished road
Oh, okay.
I thought...well...nevermind what I was thinking. It's been a rough day.
Please, someone help me. I need chocolate. Or something.
__________________

If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
Bored? Visit
http://www.kaelisspace.com/
nikkiH is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:07 AM.


Advertisement
Log in to turn off these ads.