A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: ASP-ACCESS - what's wrong with this asp code

  1. #1
    Member
    Join Date
    Jan 2001
    Posts
    32
    i gound a way (thru flashkit great resources) to store data via a ASP page into a access database.

    i could store variables and i adjusted the ASP page in order to store 3 variables...but now it doesn't work!

    anyone a cleu if a say that this is the ASP code:

    dbpath = Server.MapPath("scoretabel.mdb")
    strDBname = "Driver={Microsoft Access Driver (*.mdb)}; UID=admin; DBQ=" & dbpath
    strDBuser = ""
    strDBpwd = ""


    dbaction = request("dbaction")
    select case dbaction
    case "opslaan"
    '** opslaan in access database
    strsql = "insert into scorestore (name,keus,tied) values ("
    strsql = strsql & "'" & request("name") & "',"
    strsql = strsql & "'" & request("keus") & "',)"
    strsql = strsql & "'" & request("tied") & "')"
    dbexecute(strsql)
    Response.Write("Result=ok")
    end select

    %>

    next line are used by flash to send

    result = "";
    name = ../:name;
    keus = ../:keus;
    tied = ../:tijd;
    dbaction = "opslaan";
    loadVariables ("send.asp", self, "POST");

    i just don't seem to get the "result=ok" back as i dit before with just 2 variables.

    pls anyone?

  2. #2
    Junior Member
    Join Date
    Aug 2001
    Posts
    12
    Originally posted by Sjekke
    i gound a way (thru flashkit great resources) to store data via a ASP page into a access database.

    i could store variables and i adjusted the ASP page in order to store 3 variables...but now it doesn't work!

    anyone a cleu if a say that this is the ASP code:

    dbpath = Server.MapPath("scoretabel.mdb")
    strDBname = "Driver={Microsoft Access Driver (*.mdb)}; UID=admin; DBQ=" & dbpath
    strDBuser = ""
    strDBpwd = ""


    dbaction = request("dbaction")
    select case dbaction
    case "opslaan"
    '** opslaan in access database
    strsql = "insert into scorestore (name,keus,tied) values ("
    strsql = strsql & "'" & request("name") & "',"
    strsql = strsql & "'" & request("keus") & "',)"
    strsql = strsql & "'" & request("tied") & "')"
    dbexecute(strsql)
    Response.Write("Result=ok")
    end select

    %>

    next line are used by flash to send

    result = "";
    name = ../:name;
    keus = ../:keus;
    tied = ../:tijd;
    dbaction = "opslaan";
    loadVariables ("send.asp", self, "POST");

    i just don't seem to get the "result=ok" back as i dit before with just 2 variables.

    pls anyone?
    First thing that jumps out is sql statement built wrong, try this

    mydb=server.mappath("scoretabel.mdb")
    strconn="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE="
    strconn=strconn & mydb & ";"

    set connstr=server.createobject("adodb.connection")
    connstr.open strconn

    strSQL = "insert into scorestore (name,keus,tied) values (" & _
    "'" & request.form("name") & "'," & _
    "'" & request.form("keus") & "'," & _
    "'" & request.form("tied") & "')"

    set rstemp=connstr.execute(strSQL)

    I assume all field are text fields as you've surrounded the values with single quotes. Then instead of writing OK straight away, check that no errors occurred in the connection with

    if connstr.Errors.Count = 0 then
    Response.Write("Result=ok")
    end if

    hope this helps.

    Phil
    [Edited by UKPOD on 10-26-2001 at 05:40 AM]

  3. #3
    Member
    Join Date
    Jan 2001
    Posts
    32

    Smile

    straight answer just what i needed
    and guess what? IT WORKS


    thx alot for ya help, if i could be of any assistence... lemmeknow.

    i'm mmore graphic related and just exploring the scripting part (about time

    http://gert.uni.be/hdm

    cya!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center