Monday, April 12, 2010

XmlReader to Retrieve Multiple Rows

 SqlDatabase dbSQL = DatabaseFactory.CreateDatabase("EntLibQuickStartsSql") 
as SqlDatabase;

string sqlCommand = "SELECT ProductID, ProductName FROM Products FOR XML AUTO";
DbCommand dbCommand = dbSQL.GetSqlStringCommand(sqlCommand);

XmlReader productsReader = null;
StringBuilder productList = new StringBuilder();

try  while (!productsReader.EOF)
  {
    if (productsReader.IsStartElement()) 
    {
      productList.Append(productsReader.ReadOuterXml());
      productList.Append(Environment.NewLine);
    }
  }   
}
finally  if (productsReader != null)
  {
    productsReader.Close();
  }
}
{
  productsReader = dbSQL.ExecuteXmlReader(dbCommand);

 
{


Action Method in Mvc

In this section, you will learn about the action method of controller class. All the public methods of a Controller class are called Act...