dorandoran
Programmer
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;
}
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;
}