Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Data access page based on a parameter query

  • 24-04-2009 10:18am
    #1
    Registered Users, Registered Users 2 Posts: 197 ✭✭


    Hi

    I have created a data access page that uses a query as the datasource. I limit the rows displayed for individual users by checking the windows username and then using this against a user table in the database to apply a filter to the query. So they only see rows they should see.
    Dim login
    Set objNet = CreateObject("WScript.NetWork") 
    login = objNet.UserName 
    set rs = conn.execute("SELECT UserId FROM [T User] WHERE Username  ='" & login  & "'")
    MSODSC.RecordsetDefs.Item("Q UserStudies").ServerFilter = "[UserId] = -" & rs.fields(0)
    

    However if the page bombs out for any reason and the filter is not applied then they see all the rows, as the underlying query just gets run as is.

    I think a better way to do it would be to use a parameter query as the datasource so if anything goes wrong and the userid is not set then nothing will be displayed. However I cannot find out how to set the parameter value in vbscript. I have found a few examples but they don't seem to work.

    Can anyone give me a better way to do this or show me how to set the parameter in vbscript.

    I should mention that I am doing this as a standalone html page and not on a web server so a login page won't work as the user would have access to the data entry page also.

    Thanks

    Dave


Comments

  • Registered Users, Registered Users 2 Posts: 2,931 ✭✭✭Ginger


    A quick way would be to run this on IIS,

    And use Windows Auth as the authentication, you can then get the username and apply to the query

    Eg

    in ASP.NET to get the username its WindowsIdentity.GetCurrent().Name

    In ASP its part of the Request object which I cant remember offhand


  • Registered Users, Registered Users 2 Posts: 197 ✭✭cracker


    Thanks Ginger. The problem is that for the moment I need to implement this without deploying it on a web server. I am just putting the access database on a network share and then giving the page to each user.
    I know this is not an ideal setup but it is the situation I am stuck with for the time being. It may change in the future but for the time being I need to stick with a standalone HTML page.


  • Registered Users, Registered Users 2 Posts: 2,931 ✭✭✭Ginger


    Dont think it will work mate, if you are looking for dynamic content without using dynamic providers.


Advertisement