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.
Page 1 of 3 123 LastLast
Results 1 to 15 of 42
  1. #1
    New Coder
    Join Date
    Apr 2005
    Location
    philippines
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how to save file to ms access database using javascript?

    hi guys!
    This is my question...
    how to save file to ms access database using javascript?
    Is it possible?

    please posts any reply.....
    thanks...

  • #2
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    check out ActiveX Data Objects, then look up how to create an ActiveX object in IE using JScript. However, it should be noted that this is only achievable in Win IE, and no other browser at all, furthermore it is only suitable for clientside applications.
    *keep it simple (TM)

  • #3
    New Coder
    Join Date
    Apr 2005
    Location
    philippines
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how...

    this is my codes..
    please do any correction!
    I dont know how to do this...

    <script language="VBScript">

    Dim objRS, aConnectionString, DBObj

    aConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\Documents and Settings\Administrator.VFI\My Documents\MyRequest.mdb"
    Set DBObj=Server.CreateObject("ADODB.Connection")
    DBObj.ConnectionString = aConnectionString
    DBObj.Open
    SQLQuery = "INSERT * FROM MyRequest1"
    Set objRS=DBObj.Execute(SQLQuery)

    objRS.AddNew
    objRS.Fields("Requestor") = Request.Form("Requestor")
    objRS.Fields("Department") = Request.Form("Department")
    objRS.Fields("Date") = Request.Form("Date")
    objRS.Fields("Deadline") = Request.Form("Deadline")
    objRS.Fields("Status") = Request.Form("Status")
    objRS.Fields("Particulars") = Request.Form("Particulars")
    objRS.Fields("Comments") = Request.Form("Comments")
    objRS.Update
    objRS.Close
    Set objRS = nothing
    objConn.Close
    Set objConn = nothing
    </SCRIPT>
    Last edited by Jianet; 05-05-2005 at 09:32 AM. Reason: conflict...

  • #4
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    so what error do you get. please note, i can't test your code because I don't have Access or your DB.
    *keep it simple (TM)

  • #5
    New Coder
    Join Date
    Apr 2005
    Location
    philippines
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    hi...

    No error displayed but still no effect..
    I have forms named(requestor,department,date,deadline,status,particulars,comments). then once i filled up the form and click the save button..all the files should be sent to my access database but unfortunately it can't save file and file does'nt stored to my database.
    Can you help me? Is there any lacking?

  • #6
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Jianet
    No error displayed but still no effect
    we need to see more of your code, particularly the HTML. (use Code tags to format it nicely for us!)
    *keep it simple (TM)

  • #7
    New Coder
    Join Date
    Apr 2005
    Location
    philippines
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    here........

    Here is my codes...
    excluding the connection bec. it is already posted...
    Please help on how to do this completely.

    <html>
    <head>
    </head>
    <body>
    <table border="0" width="901">
    <tr>
    <form name=" ">
    <td width="300"><font size="4">
    <pre>Requestor:<input type="text" name="Requestor" value=""
    style="border:0px"></pre></font></td>
    </form>
    <p align="right">
    <script type="text/javascript">
    var d = new Date()
    document.write("Date: ")
    document.write(d.getDate())
    document.write("/")
    document.write(d.getMonth() + 1)
    document.write("/")
    document.write(d.getFullYear())
    </script>
    </p>
    <tr>
    <form name=" ">
    <td width="300"><font size="4"><pre>Department:<input type="text" name="Department" style="border:0px" ></pre></font></td>
    <td width="1000">
    <p align="right"><font size="4">Deadline:<input type="text" name="Deadline" style="border:0px" size="15"> </font></td>
    </tr>
    <tr>
    <td width="300">
    <p align="right">
    <td width="579">
    <p align="right"
    <select name="Status">Status <select>
    <option value="UnServed">UnServed</option>
    <font size="4">Status <size="20"> </select> </p></td>
    <td width="2">
    </tr>
    </table>
    <p></p>
    <center>
    <table border="0">
    <tr>
    <th>Particulars/Request</th>
    <th>Reaction/Comments</th>
    </tr>
    <td><textarea rows="10" cols="37"></textarea> </td>
    <td><textarea rows="10" cols="37"></textarea></td>
    </table>
    </center>
    <form>
    <p align="center">
    <a href="MyRequest.mdb" target="_blank">Open</a>
    <td></td><td><a title="Save" class="button" href="javascript:document.forms[0].submit()">Save</a >
    <a title="Cancel" class="button" href="javascript:document.forms[0].submit()">Cancel</a><input type="hidden" name="action" value="none"/>
    </form>
    <table>
    </table>
    </body>
    </html>

  • #8
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    your form won't submit because it's got no action to submit to. however, because your attempting to use JS to write to a Access DB (why you don't submit to an ASP page is beyond me), you need to call a function which then uses ADO to write to the Access DB. that's why nothing happens, because your not telling the program to do anything.
    *keep it simple (TM)

  • #9
    New Coder
    Join Date
    Apr 2005
    Location
    philippines
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Can you add the codings of my program?
    How to put a function so that the button will work?

  • #10
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I don't have time to do that. your VBS code really needs a complete overhaul, as does the HTML. I'd like to help, but I've got my own work to do which kind of suffers when I'm on here.

    here are some hints tho:

    • because you're using VBS, you need to change the language of your buttons to VBS also in order that they call the VBS function that your going to write next
    • create a function for writing to the DB. you can find out how to do that on MSDN
    *keep it simple (TM)

  • #11
    New Coder
    Join Date
    Apr 2005
    Location
    philippines
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you for sharing your knowledge...

    I just wanna ask some questions about this if its ok for you and your free...
    but this time, can you give me a little bit codes.......please!!!!!

  • #12
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    something like this:


    Code:
    Function UpdateDb()
    	objRS.AddNew
    	objRS.Fields("Department") = document.forms[0].Department
    	objRS.Update
    End Function

    Code:
    <a language="vbscript" title="Save" class="button" href="#" onclick="return UpdateDb()">Save</a>
    *keep it simple (TM)

  • #13
    New Coder
    Join Date
    Apr 2005
    Location
    philippines
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks!
    Can I approach you anytime i encountered some complicated codes of my program?
    I need more help from somebody because i am a student right now.. and i want to learn more about JS....
    God Bless!!!

  • #14
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Jianet
    Can I approach you anytime i encountered some complicated codes of my program?
    just post as normal and someone's bound to help.


    Quote Originally Posted by Jianet
    I need more help from somebody because i am a student right now.. and i want to learn more about JS.
    what you've got isn't JS, but is Visual Basic Script (VBS/VBScript). you can only use it in Internet Explorer, so it's not really suitable for the web. JS, on the other hand, can be delightful to use so don't be put off if it ever appears obtuse. by the same token, don't imagine it can do everything because it can't.


    Quote Originally Posted by Jianet
    God Bless!!!
    and you
    *keep it simple (TM)

  • #15
    New Coder
    Join Date
    Apr 2005
    Location
    philippines
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    why?

    Hi jbot...
    what is the use of href="#"
    I try to apply the codes but still no changes...Can you give me codes?
    please help me to solve the problem. I am using vbscript now...


  •  
    Page 1 of 3 123 LastLast

    Posting Permissions

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