What is wrong with this code? (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


chadb -> What is wrong with this code? (9/24/2004 11:31:07)

if Request.Form("ea1")="" Then
ea1 = "0"
else
ea1 = Request.Form("ea1")
end if
if Request.Form("Qty1")="" Then
Qty1 = "0"
else
qty1=Request.Form("Qty1")
end if

and then I am donig this later

', Total1 = '" & "$" & ea1 * Qty1 & "',"

I am getting the following error

Microsoft VBScript runtime error '800a000d'

Type mismatch: '[string: " "]'

/so/sochangeall2.asp, line 373




bobby -> RE: What is wrong with this code? (9/24/2004 11:43:25)

Is one of the form fields passing a blank space or something..?

Maybe try this instead:
 if Request.Form("ea1")<1 Then
ea1 = "0"
else
ea1 = Request.Form("ea1")
end if
if Request.Form("Qty1")<1 Then
Qty1 = "0"
else
qty1=Request.Form("Qty1")
end if 


Also, try changing the Qty1 to qty1 (match case)

Just in case the case is the problem... in this case.




chadb -> RE: What is wrong with this code? (9/24/2004 12:09:06)

I changed it, now I get the same error, but on the line
if Request.Form("ea2") >1 Then

This is happening when I leave the text box blank, so it is a null sql value, right?




Spooky -> RE: What is wrong with this code? (9/24/2004 16:00:05)

Can you 'write' the values of both strings first to be sure what you are passing?

Youll need to convert the strings into a useable format ; eg cLng(ea1) * Qty1




chadb -> RE: What is wrong with this code? (9/27/2004 11:58:16)

I set up a page that displayed the results on 1 item. If I leave the field blank, it displays nothing, if I put a 1 in the field, it displays the one, if I hit back and delete the 1, it displays a 0 like it is suppose to. So if I load the page and the field is blank, that is when it returns nothing, does that make sense??

Thanks for the help.




Spooky -> RE: What is wrong with this code? (9/27/2004 14:54:25)

So - you are saying the value of ea1 and Qty is never "0" when you first press the form submit button?
Is the form passing a space character instead?

This will hopefully clarify what the form is doing

if Request.Form("ea1")="" Then
ea1 = "0"
response.write "set to 0<br>"
else
ea1 = Request.Form("ea1")
response.write "Not set to 0<br>"
end if
if Request.Form("Qty1")="" Then
Qty1 = "0"
response.write "Qty set to 0<br>"
else
qty1=Request.Form("Qty1")
response.write "Qty not set to 0<br>"
end if




chadb -> RE: What is wrong with this code? (9/27/2004 15:38:10)

Not set to 0
Qty not set to 0




chadb -> RE: What is wrong with this code? (9/29/2004 10:32:31)

Anyone have any ideas on this??




chadb -> RE: What is wrong with this code? (10/7/2004 10:04:29)

I am still struggling with this. Any thought? [:@]




Spooky -> RE: What is wrong with this code? (10/7/2004 10:16:30)

Whats the result when you write this?

', Total1 = '" & "$" & ea1 "-" Qty1 & "',"




chadb -> RE: What is wrong with this code? (10/7/2004 10:29:04)

Is this the right syntax?
response.write ', Total1 = '" & "$" & ea1 "-" Qty1 & "',"




chadb -> RE: What is wrong with this code? (10/11/2004 11:33:57)

One thing I might add is that these fields have been written too already. The SQL value is null




Spooky -> RE: What is wrong with this code? (10/11/2004 14:07:10)

response.write "Total1 = '" & "$" & ea1 "-" & Qty1 & "',"




chadb -> RE: What is wrong with this code? (10/11/2004 14:24:41)

Microsoft VBScript compilation error '800a0401'

Expected end of statement

/so/changetest.asp, line 20

response.write "Total1 = '" & "$" & ea1 "-" & Qty1 & "',"
----------------------------------------^




Spooky -> RE: What is wrong with this code? (10/11/2004 14:26:58)

response.write "Total1 = '$" & ea1 &"-" & Qty1 & "'"




chadb -> RE: What is wrong with this code? (10/11/2004 14:29:07)

Here is the response

Total1 = '$-'




Spooky -> RE: What is wrong with this code? (10/11/2004 14:36:45)

Could you post all of the page code?




chadb -> RE: What is wrong with this code? (10/11/2004 14:39:03)

Here is the post page

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 2</title>
</head>
<%
response.write "Total1 = '$" & ea1 &"-" & Qty1 & "'"

%>
<body>

</body>

</html>

Do need any of the first page?




Spooky -> RE: What is wrong with this code? (10/11/2004 15:14:08)

Yes - I meant the actual code for the page that errors.
Also - I meant to test that code on the page that errors also! [:)]




chadb -> RE: What is wrong with this code? (10/11/2004 15:21:01)

The originating page is a Form with Database results region. Here is a link I am not sure of that link will work or help out. I am testing the code in the post (action) page!??!




Spooky -> RE: What is wrong with this code? (10/11/2004 15:50:09)

Error Type:
Active Server Pages, ASP 0126 (0x80004005)
The include file '../_fpclass/fpdblib.inc' was not found.
/pics/sochangeall.asp, line 170
??

Can you just re-clarify what you are doing?
ie - we are working here with parts of code.
What does the code do, and at what part of the process does it error?




chadb -> RE: What is wrong with this code? (10/11/2004 16:37:30)

I will try to make it simple. I have a form with 1 text box. Wehn you submit, it does to an asp page, something like this:
Sql = "UPDATE SalesOrder SET Notes = '" & Request.Form("Notes") & "',"
sql = sql & Request.form("qty1") & "', qty2 = '" & Request.form("qty2") & "',"
& "' WHERE ID Like '" & ID & "'"

fp_conn.execute(sql)

This all works fine.

So then I have another page, which is a form that displays the text boxes with the sql data. This is an example of the text boxes:
<%=FP_FieldVal(fp_rs,"Qty1")%>


On this page, I want the emplyee to be able to update the text boxes if needed. On the submit from this page I do the same as about on an ASP page. These 2 pages are where I am having troubles. if the <%=FP_FieldVal(fp_rs,"Qty1")%> text box is left blank, that is when I get the error on the submitted ASP page. Does that make any sense?




Spooky -> RE: What is wrong with this code? (10/11/2004 16:47:50)

So - once the user submits the form, this code checks for blanks? The error relates to the multiplicaton of a string?

Youve tried this code?
 if trim(Request.Form("ea1"))="" Then
ea1 = 0
else
ea1 = cInt(Request.Form("ea1"))
end if

if trim(Request.Form("Qty1"))="" Then
Qty1 =0
else
qty1=cInt(Request.Form("Qty1"))
end if 




chadb -> RE: What is wrong with this code? (10/11/2004 16:50:33)

No I will try that. By the way what does the cInt do?




Spooky -> RE: What is wrong with this code? (10/11/2004 17:03:44)

Converting from a string to an integer to allow for addition




chadb -> RE: What is wrong with this code? (10/12/2004 9:50:47)

OK Here is the problem now:

Microsoft VBScript runtime error '800a000d'

Type mismatch: 'cInt'

/so/sochangeall2.asp, line 121


Line 121 is

ea1 = cInt(Request.Form("ea1"))




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.0625