A Flash Developer Resource Site

Page 1 of 3 123 LastLast
Results 1 to 20 of 49

Thread: am i doing the right thing? asp/flash

  1. #1
    Slinky Designs slinky2000's Avatar
    Join Date
    Jun 2001
    Location
    Ireland
    Posts
    1,227

    am i doing the right thing? asp/flash

    ok, im starting to learn asp,

    im basically creating a dj database!

    it going to be a flash dj site with all the dj's profiles, pics , mixes etc on each page,

    im gonna store all the information in a database and intergrate it with flash via asp


    am i doing this right, or is there something else i need to know


    thanks
    Slinky

  2. #2
    say no more loydall's Avatar
    Join Date
    Feb 2001
    Location
    London
    Posts
    1,261
    Well,

    There's quite a few things to do in setting up something like that - best thing to do is list the process that you intend to use and also the technologies - what database etc..

  3. #3
    Slinky Designs slinky2000's Avatar
    Join Date
    Jun 2001
    Location
    Ireland
    Posts
    1,227
    well im new to this whole thing and im gonna start learning asp soon enough,

    its gonna be like this site:

    http://www.trustthedj.com/

    only local djs in ireland

    I was gonna hold all the dj's names/details in a database (access) and generate buttons at the side with there names on it. if a new dj is entered into a database then a new button/name will appear and when clicked the details of the dj will appear on a main section inc hopefully a picture!



    hope this helps

  4. #4
    say no more loydall's Avatar
    Join Date
    Feb 2001
    Location
    London
    Posts
    1,261
    Cool.

    Not sure how much asp you know but as far as that goes you need to create 1 or more pages that will display the data from the database. A couple of questions:

    How much asp do you know?
    Have you built your database yet?
    How are you connecting to the database?
    and leading on from that- what sort of hosting do you have? (i.e do you have a control panel where you can set up a dsn? otherwise you'll be using a dsn-less connection string)

    If you have built your database it would be useful to know the table names and then the column names.

    I'm guessing at the very least, you'd have a database with 1 table with 3 columns - ID, Name, Info where ID is your primary key set to auto-increment (I haven't used access for a while btw so this might all be guff)

    Beyond that, I'd really need a bit more info and wouldn't really start the flash side of things until we have an idea of the data that we're going to be throwing at it.

    Hope that helps.

  5. #5
    Slinky Designs slinky2000's Avatar
    Join Date
    Jun 2001
    Location
    Ireland
    Posts
    1,227
    i know flash very well and quite confodent with actrionscripting and the like,

    but asp i know zip!

    I havnt created the database yet but will be like you described, id, name ,experience, info, contact

    This project is a university project and will be based on the server:

    http://imdasp.infj.ulst.ac.uk/

    and since my whole class will have acess tot his server my folder will be on:

    http://imdasp.infj.ulst.ac.uk/stefan/

    or would it be easier to get some asp hosting myself?


    thanks for your help

  6. #6
    say no more loydall's Avatar
    Join Date
    Feb 2001
    Location
    London
    Posts
    1,261
    I presume that you only have access to that site from within your uni? I couldn't access it myself.

    First thing to figure out is whether your uni's servers will actually run asp scripts - there's many reasons why they would and wouldn't so I wont go into that. Create a file in notepad containing the following:

    <% response.write "ASP IS WORKING" %>

    save it as test.asp in your stefan folder and then open the page:

    http://imdasp.infj.ulst.ac.uk/stefan/test.asp

    If you just see ASP IS WORKING then we're in luck If you see anything else - an error message or even all the code in the page ie <% response write etc.... - you're going to need to either have a word with the IT people at your uni to find out if you can have asp set up for you or you might want to look at finding a host.

    Once we've got that sorted, you can start building your page.


  7. #7
    Slinky Designs slinky2000's Avatar
    Join Date
    Jun 2001
    Location
    Ireland
    Posts
    1,227
    hey mate, ive emailed the technician to set me up a folder and a username and pass because i havnt it set up yet,

    you can see it outside uni as soon as an index page is up

    i'll get back to you when i get a folder up!

    cheers

  8. #8
    Slinky Designs slinky2000's Avatar
    Join Date
    Jun 2001
    Location
    Ireland
    Posts
    1,227
    hope this helps, this email is from the technician, i've blocked out a few things:



    this page is workin now

    http://imdasp.infj.ulst.ac.uk/stefan/test.asp

    ----------------------------------------------------------

    ----------------------------------------------------------


    I have set up an account for you on imdasp. Here are the details:-

    1. Access

    You can access this server by FTP from anywhere with an Internet
    connection :-

    Host imdasp.infj.ulst.ac.uk
    Username: ******
    Password: ******

    Cd to your directory which is \aspwork\stefan

    Or by mapping a drive from within the IMD lab:-

    Open My Computer or Windows Explorer
    Choose Tools, Map Network Drive
    In the Folder box enter: \\imdasp\aspwork\stefan
    Uncheck the Reconnect at logon box
    Click connect using a different username
    You will be prompted for above username and password
    Click Finish
    Your directory should appear under the drive letter
    To log off, right click your directory and select Disconnect.

    2. Changing the password

    It is recommended that you change your password as soon as possible for
    this account. You can do this from within the IMD lab as follows:-

    Ctl-Alt-Del, Change Password, highlight imdasp, and enter required
    password details.

    3. Making a database writeable from the web

    If you are writing ASPs that accept user data from a web page and write
    it to a database, you will need to make that database writeable over the
    web. You can do this as follows within the IMD lab:-

    Highlight your database file
    Right click it and choose Properties
    Select the Security tab
    Click Add
    In the Select Users or Groups window scroll the list of users presented
    select IUSR_IMDFILE click Add, and OK
    In the Properties Security window, select Internet Guest
    Account(IMDASP\IUSR_IMDFILE)
    Tick the Write box and OK it

    4. Using a DSN-less connection

    If you are using a DSN-less connection to a database, you will need to
    enter the full path to the database. It will be:
    D:\aspwork\keag\<your_database_path>

    5. Viewing your work

    To view your work over the web, your address will be:-
    http://imdasp.infj.ulst.ac.uk/stefan/

    Please use this web site for ASP work only - there is not enough space
    on the server to store large web sites for each student.

    Regards,


    ----------------------------------------------------------

    ----------------------------------------------------------
    Last edited by slinky2000; 02-21-2003 at 11:14 AM.

  9. #9
    say no more loydall's Avatar
    Join Date
    Feb 2001
    Location
    London
    Posts
    1,261
    All good stuff,

    Right - next stage is to build your database and set up a test page to see that your conection is working. There's a bit of script below that should do the job although it may not for various reasons again but I think it's a good place to start. I'm also asuming a number of things:

    1: You have built a database called data.mdb
    2: You have saved it in the D:\aspwork\keag\ directory
    3: You have a table called people
    4: You have a column called Name
    5: You have at least one record in your database (just enter some random data)

    Open up that test file you did earlier and replace what's in it with:

    <%

    set dj = Server.CreateObject("ADODB.Recordset")


    dj.ActiveConnection = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=D:\aspwork\keag\data.mdb"


    dj.Source = "SELECT * FROM people"

    dj.Open()

    response.write (dj.Fields.Item("Name").Value)

    %>


    BTW - in case it's not clear the second line starting dj.Active ect.. is all one line as far as - ...\data.mdb"

    You can split it over several lines using an underscore but dont worry about that for now.

    Notice the path to your database in the second line? Change that if required - it should make sense to you.

    Save it and open it:

    http://imdasp.infj.ulst.ac.uk/stefan/test.asp

    If you see the name of person in the first record of your database on the screen - Huraahh. If you don't and you get an error message - Booooo. If you do - post the error message here and I'll have a look for you.

  10. #10
    Slinky Designs slinky2000's Avatar
    Join Date
    Jun 2001
    Location
    Ireland
    Posts
    1,227
    sorry its takin me a while, i havnt been near a computer over the weekend,

    anyway

    ive got the database called data and a table called people and a colum called Name


    when i open my aspwork folder theres no Keag folder so i made my own and the database is in in,


    i careated an asp file with the code:

    <%

    set dj = Server.CreateObject("ADODB.Recordset")


    dj.ActiveConnection = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=D:\aspwork\keag\data.mdb"


    dj.Source = "SELECT * FROM people"

    dj.Open()

    response.write (dj.Fields.Item("Name").Value)

    %>



    but it comes up no page found? any ideas?

  11. #11
    Slinky Designs slinky2000's Avatar
    Join Date
    Jun 2001
    Location
    Ireland
    Posts
    1,227

  12. #12
    say no more loydall's Avatar
    Join Date
    Feb 2001
    Location
    London
    Posts
    1,261
    Ah.

    It has found the page but there's an error message. Unfortunately your uni system is set up to just say that there's an error and not what the error is so it's difficult to say exactly what the problem is although there's not loads of things that can be going wrong here so we're not really in trouble yet.

    It will definately be the connection string that's causing this.

    Try this instead:

    <%

    set dj = Server.CreateObject("ADODB.Recordset")


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


    dj.ActiveConnection = strconn

    dj.Source = "SELECT * FROM people"

    dj.Open()

    response.write (dj.Fields.Item("Name").Value)

    %>

    Also, there may be some sort of permissions thing going on so it's worth doing what your IT guy said:

    Highlight your database file
    Right click it and choose Properties
    Select the Security tab
    Click Add
    In the Select Users or Groups window scroll the list of users presented
    select IUSR_IMDFILE click Add, and OK
    In the Properties Security window, select Internet Guest
    Account(IMDASP\IUSR_IMDFILE)
    Tick the Write box and OK it

    Although we're not writing to the database at the moment, it might be worth doing this all the same.

  13. #13
    Slinky Designs slinky2000's Avatar
    Join Date
    Jun 2001
    Location
    Ireland
    Posts
    1,227
    woohoo mate, it worked! happy days!

    i took it out of the keag folder i made and just put in in the same folder as test.asp.


    happy days!

  14. #14
    say no more loydall's Avatar
    Join Date
    Feb 2001
    Location
    London
    Posts
    1,261
    Cool

    That's the hardest bit done I rekon - if you know your flash stuff anyway.

    What you need to do now is decide what data you will need to generate the links/buttons in your flash file. I presume you'll only need the name in the button and then all the other info when the user clicks the button?

    Actually, you'll probably need 2 bits of info - the Name and also the ID of each record so you know which record to open in full when the button is clicked.

    What you need is to do a bit of work on that page you just got working so that it displays all the names in your database along with their ID's. There's a number of ways of displaying data in asp and grabbing it in flash but the way I like to do it is just have the asp file write out all data seperated by some sort of character eg:


    bob*pete*dave*carl etc.... using * as the seperator

    What you can do is write out the name then a * then the ID then a * and so on. You'll also need to name this string as a variable so your final output will be:


    data=bob*1*pete*2*dave*3*carl*4*....etc.....

    you'll then need to load that variable in flash (easy for you yeah?)

    and split it at every * to create a nice big array from the data.

    Whoooaaaaa - first things first. Build your page that displays your data.

    You want a hand with that?

  15. #15
    Slinky Designs slinky2000's Avatar
    Join Date
    Jun 2001
    Location
    Ireland
    Posts
    1,227
    i can build the page first, or if you make a simple one i can modify it later on, cos i havtn finalised a design yet for the site,

    basically a bit like this (very simple) (attached)


    im hop[in it'll be a bit like tyhis when finished:

    http://ijsr32.infj.ulst.ac.uk/~10214...ayout_5.1.html
    Last edited by slinky2000; 09-01-2009 at 11:18 AM.

  16. #16
    Senior Member
    Join Date
    Sep 2002
    Location
    Texas
    Posts
    348
    This thread is great! Im connected! I owe you a virtual beer. But here's a donut


    Thanks!
    Great minds think for themselves.

  17. #17
    say no more loydall's Avatar
    Join Date
    Feb 2001
    Location
    London
    Posts
    1,261
    Mmmmm donut.

    Right - onwards and upwards. Looping through your recordset and displaying them in a formatted way. This is as basic as it comes for this sort of thing so perhaps isn't the best code you'll see but it will do the job. It's basically the file that you've already got but we're looping through all the records in the database, writing out the name and ID and seperating them with a *.

    You may need to change the connection string bit to whatever you've got working at the mo:


    <%

    set dj = Server.CreateObject("ADODB.Recordset")

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


    dj.ActiveConnection = strconn


    dj.Source = "SELECT * FROM people"

    dj.Open()

    response.write "data="

    while not (dj.eof)

    response.write (dj.Fields.Item("Name").Value)

    response.write "*"

    response.write (dj.fields.Item("ID").Value)

    response.write "*"

    dj.movenext

    wend

    %>

  18. #18
    Senior Member
    Join Date
    Sep 2002
    Location
    Texas
    Posts
    348
    So how do I write to a database from ASP?
    Great minds think for themselves.

  19. #19
    say no more loydall's Avatar
    Join Date
    Feb 2001
    Location
    London
    Posts
    1,261
    Right, well then,

    Lets say you've got a similar set up to the database we're already using - data.mdb with a table called people with columns called Name and Age - for example. Lets say you have a form on one page of your site that collects data from users. There are two text fields in your form called Name and Age. You also have a submit button and the form posts to another page called, for example, two.asp.


    in that page you'd have the code:

    <%

    Name = request.form ("name")
    Age = request.form ("age")


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


    strSQL = "INSERT INTO people(Name, age) "
    strSQL = strSQL & "Values('" & Name & "', '" & age & "')"


    set conn = server.createobject("ADODB.Connection")
    conn.open strconn

    conn.execute(strSQL)

    conn.close
    set conn = nothing

    response.write "thanks for your info"

    %>

    That reminds me of something I forgot to mention that is very important - always close your connection to the database after you're done (the conn.close bit). You should also always define your variables before you use them e.g 'dim name,age, strSQL...' not essential but good practice, especially later on when you're debugging and you use option explicit which forces you to define them but helps you find any errors.. Anyway enough of that.


    You can also grab data from a flash form in exactly the same way although you may need to use 'request.querystring' instead of 'request.form' if the data from the form is being appended to the url of two.asp (in this case it would look something like: www.yoursite.com/two.asp?name=bob&age=10 )


    Get it ???




    edit: dont click on that link BTW - I forgot that there might be a yoursite.com.... unless you want a new credit card that is...

  20. #20
    Senior Member
    Join Date
    Sep 2002
    Location
    Texas
    Posts
    348
    in this part
    strSQL = strSQL & "Values('" & Name & "', '" & age & "')"
    Why do you have a single quote then double?
    Great minds think for themselves.

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