Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQLDataAccess and Business Objects
Message
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
00902803
Message ID:
00903543
Views:
18
This message has been marked as the solution to the initial question of the thread.
>Maybe my post wasn't clear enough, I apologize for that.
>
>What I need is how do I get data from the ClientAccessDataSQL. How do I invoke it to get a dataset back.
>
>I can't find any code and all the code I did find point at defining a new connection, I thought this was all handled in the class.
>
>I have no code in that method, because I don't know what to put. Your example is fine. I have followed it but it doesn't cover getting data back from a DataAdapter, it used the MM stuff.
>
>I hope this clears things up.

You access the custom data access class from within the business object just as you normally access a generic data access class. For example, the first line of code in the following methods uses the GetDataAccessObject() method to retrieve a reference to the data access object. This call is the same regardless of whether you are using a generic or custom data access object:

In C#:
public DataSet GetOrdersByCustomerAndEmployee(string custID, int employeeID)
{
	// Get a reference to the data access object
	mmDataAccessBase dao = this.GetDataAccessObject();

	// Create and configure two parameter objects
	IDbDataParameter param1 = dao.CreateParameter("@CustomerID", custID);
	IDbDataParameter param2 = dao.CreateParameter("@EmployeeID", employeeID);

	// Get a DataSet filled with the result set
	return this.GetDataSet("SELECT * FROM Orders WHERE CustomerID = @CustomerID AND " +
		"EmployeeID = @EmployeeID", param1, param2);
}
And in VB .NET:
Public Function GetOrdersByCustomerAndEmployee(ByVal custID As String, ByVal employeeID As Integer) As DataSet
	' Get a reference to the data access object
	Dim dao As mmDataAccessBase =  Me.GetDataAccessObject() 
 
	' Create and configure two parameter objects
	Dim param1 As IDbDataParameter =  dao.CreateParameter("@CustomerID",custID) 
	Dim param2 As IDbDataParameter =  dao.CreateParameter("@EmployeeID",employeeID) 
 
	' Get a DataSet filled with the result set
	Return Me.GetDataSet("SELECT * FROM Orders WHERE CustomerID = @CustomerID AND " +
		"EmployeeID = @EmployeeID", param1, param2)
End Function
Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform