GetRecord method VB.net 2.0 SQL 2005 Server Find record with where clause

I am using I have a master-Detail page where the master displays an account record.
the detail displays all transactions related to that specific account.
The particular transactions are subject to approval by users with authority to approve each transaction.
I have  image buttons that default to visible = false in the detail row.
The image button links to  a page that allows the logged in user to approve the transaction.

i need to make the imagebutton visible=true  based on a function that checks the logged in users
record to check if the logged in user has permission to approve a transaction.

I need a function that grabs the logged-in user id and gets the users record from a table that has the
user information that determines if the logged in user has permissions to approve the transaction.
If so then I need to make that imagebutton visible.on display.

I have the code that grabs the logged in userID from the session.
"Dim userID As String = Me.Page.SystemUtils.GetLoginId()"

I need the Logged -in userID and the organizationID to tell the function what record to retrieve.
The OrganizationID is passed to the master page through a querystring =?Organization


The table I have to get the user record from is titled" IndividualsinOrganizations"

Table  IndividualsinOrganizations
FieldName      Datatype     Filter or conditional
IndividualID      integer      This should correspond with the UsrID =logged in userID
OrganizationID Integer      This should correspond to the OrganizationID in the  current Record.
Active               bit             =true
StartDate          smallDatetime   =< currentDate
EndDate          SmallDatetime      => currentDate
CheckApproval   bit                   =True


I am told I can use a GetRecord(s) method to retrieve the record based on the logged in UserID and organizationID.
Once i retreive the record I can use the where clause to determine if the logged user has rights to approve the transaction therefore I can make the image button visible
It has also been suggested that I put this function in the DataBind method of the recordControlRow.

How can I write this code so it works?







tommynationsAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Arthur_WoodCommented:
Is this for a WinForm application, or ASP.NET Web application?
0
tommynationsAuthor Commented:
This is a ASP.net application
Using VisualBasic.net and sqlserver 2005
0
Arthur_WoodCommented:
There is a GetRows method, but it only applies to an ADO recordset object, which I doubt you want to be using with ASP.NET and VB.NET - you would be much better off learning about using DataTables and DataAdapters to retrieve data from a SQL Server Database.
You want to make use of ADO.NET - which is not the same as classic ADO (which was used in VB6, with JET databases, such as Access).
I am not aware of a GetRecords method for use with ADO.NET
AW
0
tommynationsAuthor Commented:
Visual Basic .NET: example of GetRecord method used in Northwinds database.

Dim myRecord As OrdersRecord

Dim whereStr As String = "EmployeeID='1'"

myRecord = OrdersTable.GetRecord(whereStr)



0
Arthur_WoodCommented:
The OrdersTable class has a static GetRecord Method which returns, as a value, an object of type OrdersRecord.  That was built into the code from the class, and it is not a standard method found in just any class.  You would need to look at the code for the OrdersTable class, to see if you could modify it to meet your specific needs.  

My guess, without seeing the actual source code, would be that in the present situation, the OrdersTable.GetRecord would return the most recent Order record for the indicated employee, based on the whereString.   Mind you, that is a guess.  

I do not see how that is directly related to the Table that you have, but it may be possible to create a class, modelled on the OrderTable class, that might do the job.

AW
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.