locked
Retrieving data for a specific user RRS feed

  • Question

  • User-1302067168 posted
    hi guyz have a problem of retrieving data for a specifis user I want to my application to retrieve data for a specific user usign windows authentication,now all the users can retriv all the records even the ones that don"t belong to them,please help give me some ideas and samples thankx in advance ppm
    Wednesday, February 11, 2004 9:01 AM

All replies

  • User-1907454718 posted
    If your security on the server is set up correctly, you should be able to use integrated security to get this working the way you want. Since you are in the Microsoft Data Access Application Blocks forum, I'll assume you have sQL Server db. So look into books online for answers to this. This is a great resource and should be installed when you install SQL Server Client tools. Your question is a little broad, so perhaps you can post the code that is doing this.
    Thursday, February 12, 2004 9:42 AM
  • User-1302067168 posted
    hi here s my code Public Function login(ByVal login1 as string) as dataset Dim myconnection as new sqlconnection("server=G103-TT03;database=CampusLANDB;Trusted_Connection=yes") dim mycommand as new sqlcommand ("Select* From tNics Where login1 = @param1",myconnection) mycommand.parameters.add(new SQLClient.SqlParameter("@param1",login1)) dim DS as new dataset() try myconnection.open dim adpt as new sqldataadapter adpt.selectcommand = mycommand adpt.fill(DS,"tNics") return DS catch ex as exception throw new exception(ex.message) return nothing finally myconnection.close end try try mydatagrid.datasource=DS.Login("Login1") mydatagrid.databind() catch ex as exception errorlabel.text=ex.message end try End Function what could be a roblem thanks is advance ppm
    Saturday, February 14, 2004 1:48 PM
  • User-1907454718 posted
    Have you run your sql in query analyzer to see what it is actually returning? The code looks correct. Now keep in mind you have posted to the data access application blocks forum, which means you *should* be using code like this: Public Function login(ByVal login1 as string) as dataset Dim arParms() as SQLParameter(1) arParms(0) = new SQLParater("@param1", login1) dim DS as new dataset() try ds = sqlHelper.ExecuteDataset(("server=G103 - TT03;database=CampusLANDB;Trusted_Connection=yes", StoredProcedure, spname, arParms) return DS catch ex as exception throw new exception(ex.message) return nothing end try try mydatagrid.datasource=DS.Login("Login1") mydatagrid.databind() catch ex as exception errorlabel.text=ex.message end try End Function What I would first try is seeing if you arereturning anything in QA
    Monday, February 16, 2004 8:02 AM
  • User-1302067168 posted
    hi again I treid to use this query statement for in QA it returns only the columns ,I though it will return all the columns and some records of (lmeyer) as the current user ,who logged in on windows auth,but it return only the columns,is that means my query analyser cannot to read the login1 ,column which has the username as (lmeyer) select * from tstudents where (login1='@param1') also i tried the code to gave me ,i have a problem of declaring SQLHelper,where should I declare this . thankx in advance pamela mkosana
    Friday, February 20, 2004 6:37 AM