[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2008-11-03
5
Medium Priority
?
474 Views
Last Modified: 2012-05-05
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?







0
Comment
Question by:tommynations
  • 3
  • 2
5 Comments
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 22876962
Is this for a WinForm application, or ASP.NET Web application?
0
 

Author Comment

by:tommynations
ID: 22877914
This is a ASP.net application
Using VisualBasic.net and sqlserver 2005
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 22878429
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
 

Author Comment

by:tommynations
ID: 22881304
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
 
LVL 44

Accepted Solution

by:
Arthur_Wood earned 1500 total points
ID: 22881500
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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Ready to get certified? Check out some courses that help you prepare for third-party exams.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Suggested Courses

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question