AccessDataSource in VisualStudio2003

Oct 5 2006 4:53 AM
Hi,
I'm a newbie and am plugging my way through Murach's ASP.NET 2 for VS2005.
As I'm developing with VS2003 there are a few differences.

The example (which I'm determined to get through, one way or another) uses AccessDataSource.
These don't exist in VS2003.

I am succesfully connecting to a SQL Server database, retrieving data and binding a list to a drop-down.

I have a function GetSelectedProduct, which needs to retrieve a Product object (with name, price, image name etc.) from the DB when a product is selected from the drop-down described above.

The example (listed below) casts the datasource as a dataview, uses a rowfilter and populates the Product object.

Any help or advice is greatly appreciated.



private Product GetSelectedProduct()
{
  DataView productsTable = (DataView) AccessDataSource1.Select(DataSourceSelectArguments.Empty);
  productsTable.RowFilter = "ProductID = '" + ddlProducts.SelectedValue + "'";
  DataRowView row = (DataRowView) productsTable[0];

  Product p = new Product();
  p.ProductID = row["ProductID"].ToString();
  ...
  return p;
}