Forum Moderators: open

Message Too Old, No Replies

FLASH -> ASP -> MS-Access : PLEASE HELP

Please help with a simple flash input form.

         

carmo

1:18 am on Jan 25, 2002 (gmt 0)



*******
I just want to try a simple input form with flash. I created two input boxes and a submit button in flash. The variable names for the input boxes are "Name" and "Age".

The actions attached to the submit button are:

OnMouseEvent(Release) {
loadVariablesNum("submit.asp,"0","GET")
}

From what i know, that is all I really need to send the variables to the submit.asp page.
**********
I created a database with DSN "submit"
**********
Here is the code I made for the ASP page:

<%@Language = "VBScript"%>

<%
Option Explicit

Dim rsAdd
Dim connAdd
Dim strName
Dim strAge

Set connAdd = Server.CreateObject("ADODB.Connection")

connAdd.Open "submit"

Set rsAdd = Server.CreateObject("ADODB.Recordset")

strName = Request.Form("name")
strAge = Request.Form("age")

strAdd = "INSERT INTO submit(name, age) VALUES ("&strName&","&strAge&")"

connAdd.execute strAdd

connAdd.close
set connAdd = Nothing

%>

****************
Well, this doesn't work. CAN someone please tell me why???? THANK YOU!

bmcgee

1:49 am on Jan 25, 2002 (gmt 0)

10+ Year Member



I would assume that "name" is a string field, and "age" is a numeric field.

If so, you need the SQL code to look like this (note the ticks, although it's hard to read):
strAdd = "INSERT INTO submit (name, age) VALUES ('" & strName & "'," & strAge & ")"

So strAdd would look like this:
INSERT INTO submit (name, age) VALUES ('joe q public', 31)

carmo

2:04 am on Jan 25, 2002 (gmt 0)



For the sake of simplicity, I made the "name" and "age" fields in the database as datatype "text". I added the extra quotes, but still doesn't work.

Additional Information:

- Yes, i am running from localhost using IIS
- I set up an ODBC for the database

bmcgee

1:53 am on Jan 26, 2002 (gmt 0)

10+ Year Member



if "Age" is a text field also, you will need the ticks around its value as well.

If that still fails, please print out the final sql string that you send (not just the code) and give that to us. Also, please paste the exact error you are getting, to confirm what line of the ASP code is actually failing.

bmcgee

2:26 am on Jan 26, 2002 (gmt 0)

10+ Year Member



Just as another possibility, it may be your connection is failing before it even reaches your INSERT statement.

Don't quote me, but you might also need:
connAdd.open "DSN=submit"
instead of:
connAdd.open "submit"

carmo

12:22 am on Jan 30, 2002 (gmt 0)



Well, I tried adding the "DSN = ", but it still doesn't work......This is driving me nuts!...Thanks anyway.

click watcher

12:58 am on Jan 30, 2002 (gmt 0)



>>>OnMouseEvent(Release) {
loadVariablesNum("submit.asp,"0","GET")
}

theres some quotes missing "submit.asp"
i'm sure you already knew that and it was a typo, but just in case it wasn't.

carmo

1:47 am on Jan 30, 2002 (gmt 0)



That was just a typo...but thanks.

bmcgee

3:51 am on Jan 30, 2002 (gmt 0)

10+ Year Member



carmo, paste in the exact error message you are getting. It will give us a better idea of where your code is failing.

jimmykav

8:56 am on Jan 30, 2002 (gmt 0)

10+ Year Member



Do you have write access to the database in question?

try inserting:

connAdd.mode = 3

before
connAdd.open ....

carmo

8:29 pm on Jan 30, 2002 (gmt 0)



There is no error messege. When I click on the flash submit button, nothing happens. Below is the exact asp code that I have for an asp page called "submit.asp"

<<<<<<<<<<SUBMIT.ASP>>>>>>>>>>>>>>>>>>>>>

<%@Language = "VBScript"%>

<%

Option Explicit

Dim connAdd
Dim strName
Dim strAge
Dim strAdd

strName = Replace(request("name"), "'",""")
strAge = Replace(request("age"), "'",""")

Set connAdd = Server.CreateObject("ADODB.Connection")

connAdd.Open "submit"

strAdd = "INSERT INTO submit(name, age) VALUES ('"&strName&"','"&strAge&"')"

connAdd.execute strAdd

connAdd.close
Set connAdd = Nothing

%>

Check it out if you guys get a chance. Thanks

Thanks
Mark

carmo

9:41 pm on Jan 31, 2002 (gmt 0)



THE FIGHT IS OVER,,,I GOT IT TO FINALLY WORK.

NOTE: When you are having your ASP page retrieve variables from Flash, you cannot use Request.Form("variable") ...just use
Request("variable").

Here is my new code for anyone interested:

<% Language = "VBScript" %>

<%

Dim conn
Dim rs
Dim query

Set conn = server.createObject("ADODB.Connection")

conn.Open "submit"

Set rs = server.createObject("ADODB.Recordset")

query = "select * from submit"

rs.Open query, conn, 3, 3

rs.addNew

rs("name") = Request("name")
rs("age") = Request("age")
rs.update

rs.close
conn.close
Set rs = Nothing
Set conn = Nothing

%>

Cheers,
Carmo

jimmykav

9:59 pm on Jan 31, 2002 (gmt 0)

10+ Year Member



Well done carmo :)