Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

alternate to accessdatasource 1

Status
Not open for further replies.

dorandoran

Programmer
Oct 11, 2004
48
US
I got this from I dont like using accessdatasource. What are my option? (what I really like is to create a class and create object in the form, I backend is sql server. Can anyone please please help?)
Thanks
<Do>

private AccessDataSource ChildDataSource(string strCustometId, string strSort)
{
string strQRY = "";
AccessDataSource dsTemp = new AccessDataSource();
dsTemp.DataFile = "App_Data/Northwind.mdb";
strQRY = "SELECT [Orders].[CustomerID],[Orders].[OrderID]," +
"[Orders].[ShipAddress],[Orders].[Freight],[Orders].[ShipName] FROM [Orders]" +
" WHERE [Orders].[CustomerID] = '" + strCustometId + "'" +
"UNION ALL " +
"SELECT '" + strCustometId + "','','','','' FROM [Orders] WHERE [Orders].[CustomerID] = '" + strCustometId + "'" +
"HAVING COUNT(*)=0 " + strSort;

dsTemp.SelectCommand = strQRY;
return dsTemp;
}
 
you wouldn't create an object to create a datasource control. you would write the code using ado.net objects.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
 
Hi Jason,

can you send me few good google links as I understand you are busy with your normal duties.

oh, really thankfull for your time and replay.

Do
 
can you send me few good google links as I understand you are busy with your normal duties.
um... you could google it too :)

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
 
Hi Jason,

Only if knew the right keywords. LOL. I did it but i would like to create a class (dataaccess class) and then create an object from that class.

Thanks for your help.
 
Code:
class MyClass
{
    public IEnumerable<MyEntity> GetEntities(...)
    {
         // code to return an enumeration of entities.
    }
}

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
 
Thank you sir. truly appreciate it your prompt respond with details.

Again
Thanks
Do
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top