June 2006 Entries

Asynchronous Commands

To enable asynchronous command , the firts step is to set the new Async attribute to true in the connection string, other wise an exception will be thrown.There can be three different ways to build asynchronous commands : nonblocking , polling,callback Nonblocking Commands // Start a non-blocking execution IAsyncResult iar = cmd.BeginEcecuteReader(); // Do something else meanwhile ........................ // Block the execution untill done SqlDataReader reader = cmd.EndExecuteReader(); //Process...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Better way of using SqlCommand

Just came accross this following snippet. using(SqlConnection conn = new SqlConnection) { conn.Open(); SqlCommand cmd= new SqlCommand(); cmd.ExecuteNonQuery(); conn.Close() } It's always better off cosing this inside a using block , bcoz what is the command thows an exception. Inside the using block the object wil always be disposed .
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

OR Mapping/Objects Spaces

I was trying to know what nHibernate does before installing it in my pc, when I cam accross the word “OR Mapping” (Object Relational Mapping). I found this link very useful to know a bit about OR Mapping,ObjectSpaces and nHibernate http://www.dotnetspider.com... http://msdn.microsoft.com/l... http://www.theserverside.ne...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

StringCollection Vs ArrayList

I was thinking of using a StringCollection instead when I came accross this link http://weblogs.asp.net/just... oops ...................
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Problem storing a Generic list object in Viewstate

I had an generic object that implements and I was just trying to store that object in ViewState. THis was where i first stumbled as it was giving me an error that basically tells that “Cannot serialze a generic list object”. After I did a bit of googling I found out that I need to make that object XmlSerializable inoder to be strored in Viewstate. I used the [serializable ] attribute on the class that I wanted to serialize. Still i was giving me error. After a quite prolonged step into...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Send Mail in ASp.NET 2.0

I was just trying to send a mail using ASP.NET 2.0. I was astonished to find out that the namespace used in ASP.NET 1.1 has for sending mail has become obsolete in ASP.NET 2.0 Previously it was System.Web.Mail, now it is System.Net.Mail
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Getting Values After Server.Transfer

I was just trying to get the values of the previous page after doing a Server.Transfer. Page caller = (Page)Context.Handler or CallingPage=(CallingPage) System.Web.HttpContext.Curr... This Does the trick....
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati