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?
 
Arthur_WoodConnect With a Mentor Commented:
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
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.