Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Dec 2006
    Location
    Malaysia.
    Posts
    32
    Thanks
    19
    Thanked 0 Times in 0 Posts

    Unhappy Data is not store in my database file? why?

    Hi...

    i need some help here..

    i am creating a website for my final project... which it is reservation system.. after i've key in all the data and click on submit button, it's link to another page... and then when i try open the database. whatever data i've keyed in earlier is not in the database files...

    what should i do? help me..

    im using windows XP , i've also installed IIS... and i've already set the the data source (ODBC ) ... what else should i have to set ?

  • #2
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    Thanked 110 Times in 109 Posts
    You'll need some code that takes the form contents and writes it to the database. Have you written this code? If so, can you post it up here?

  • #3
    New Coder
    Join Date
    Dec 2006
    Location
    Malaysia.
    Posts
    32
    Thanks
    19
    Thanked 0 Times in 0 Posts
    i've posted the code in this forum earlier, but no one help me or tell me.. what i've wrote is wrong..

    Why the data is not in my database files.?

    can u check it and let me know about it.. thanks buddy...

  • #4
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    Thanked 110 Times in 109 Posts
    Well... it looks ok. You talk about setting up a DSN but you're connecting using a DSN-less connection, and there's an include file called "connection.inc" - that sounds database-related, and I don't know what's in it.

    I don't like using recordsets to do database inserts. I don't see the point. Create an SQL string, get the connection to execute it directly. That way if it goes wrong you can at least write it out and see what you're actually telling the database.

    For now... hmm. Not sure. You're not getting any sort of error message? Not even in the HTML source? (sometimes it gets hidden). Try adding:
    Response.Write(myconn.State)

    immediately above the line:
    Set Rs=Server.Createobject("ADODB.Recordset")

    Just to check that you're actually connecting to your database. You should get a "1". If you get a "0" or a "2", your database either isn't where you think it is, or isn't readable.

  • #5
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    This is all FrontPage driven webbots (including the JavaScript validators and the database inserts).

    You could cut your code in half if you used Request.form and an INSERT statement.

    Since you are using Access, you don't need the Connection.inc file. Everything you need in Connection.inc is included in lines 18-22 posted below:

    Code:
    Set myconn=server.CreateObject("ADODB.Connection")
    myconn.open "Provider=Microsoft.jet.oledb.4.0;data source=" & Server.MapPath("Hotel Reservation.mdb")
    Set Rs=Server.Createobject("ADODB.Recordset")
    ssql="select * from Reservation"
    rs.open ssql,myconn,1,2
    The way that you are connecting to your database, it looks as though you need to supply a username and a password to access the database.

    Do as Spudhead asked and response.write your Connection State.

    If you get either a "0" or a "2", then check to make sure your Access database doesn't have a username and password associated with it.

    If it does, change your connection string to:

    Code:
    myConn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("Hotel Reservation.mdb") & ";User Id=admin;Password=;"
    
    OR
    
    myConn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("Hotel Reservation.mdb") & ";Jet OLEDB:Database Password=MyDbPassword;
    where User Id == your username and Password == your password

    HTH!


  •  

    Posting Permissions

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