Results 1 to 2 of 2

Thread: hey mark, how can i do this? :)

  1. #1

    Thread Starter
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    Er.. I don't know if this question was for me...

    I only just noticed it and unfortunately (for you) I'm off work for a week or so and I won't have a chance to have a play!

    Most of the more tricky ASP stuff I write is just by trial-and-error. I'm self taught with the ASP stuff and I just hack around with the code until it does what I want it to do.


    Good luck in trying to get it to work and I'll try and have a play as soon as I get a chance.


    Mark
    -------------------

  2. #2
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    You could do it through automation, but you can also use ADO and access it like any other database

    Just remove the data types and enumeration constants and it should be all set for ASP...(and of course the messagebox)
    Code:
    'uses ado 2.1 or higher
    
        Dim cn As New Connection
        Dim rs As New Recordset
        
        cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Test.xls;Extended Properties=Excel 8.0;"
        
        'excel sheet name here
        'must enclose in brackets, sheet name followed by a dollar sign
        rs.Open "Select * from [Sheet1$]", cn, adOpenKeyset, adLockOptimistic
        
        'see value
        MsgBox rs.Fields(0).Value
        
        'change it
        rs.Fields(0).Value = rs.Fields(0).Value & "3"
        
        'update
        rs.Update
        
        'verify change
        MsgBox rs.Fields(0).Value
    If you would rather do it through automation, let me know and I'll whip up some code


    Tom

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