BUGFIX: Internet file select and upload Dialog

I fixed the problem of displaing the icon of a file with uppercas exetnsion and store the information about allowed maxmal/total/minimal pixels for images and filesizes for upload in a session now. I fixed displaing image files that don't fit the defined pixels in the browse window on the internet server.I fixed the message when triing to upload a file that already exists.

OleDb, Decimal and DBConcurrencyException

I had some trouble with a WebForm, including a OleDbDataAdapter, a DataSet and uses the OleDbCommandBuilder to publish the CommandText property to the DataAdapter, that tries to update five Decimal columns in a Access database. No matter what i did the Update method of the DataAdapter threw a DBConcurrencyException. After googling a few minutes i found someting about the ODBC/JET data type limit.So i canged the Decimal to a Double and now all works fine. 

HttpApplication Events and the use of Application, Session, User, Request & Response

I just wanted to write this down somewhere to keep it in mind but it may be useful for others to.     protected void Application_Start(Object sender, EventArgs e)    {        //Application        //Request    }    protected void Session_Start(Object sender, EventArgs e)    {        //Application        //Request        //User        //Session        //Response    }    protected void Application_BeginRequest(Object sender, EventArgs e)    {        //Application        //Request        //Response*    }        protected void Application_PreSendRequestHeaders(Object sender, EventArgs e)    {        //Application        //Request        //User        //Session        //Response    }    protected void Application_AuthenticateRequest(Object sender, EventArgs e)    {        //Application        //Request        //User        //Response*    }    protected void Application_PostRequestHandlerExecute(Object sender, EventArgs e)    {        //Application        //Request        //User        //Session        //Response*    }    protected void Application_EndRequest(Object sender, EventArgs e)    {        //Application        //Request        //User        //Response*    }        protected void Session_End(Object sender, EventArgs e)    {        //Application        //Request        //User        //Session        //Response    }    protected void Application_Error(Object sender, EventArgs e)    {        //Application        //Request        //User        //Session        //Response    }    protected void Global_Error(Object sender, EventArgs e)    {        //Application        //Request        //User        //Session        //Response    }        protected void Application_End(Object sender, EventArgs e)    {        //Application        //Request        //User        //Session        //Response    }* Produces output

BusinessObjects: filling "this" and classes or structs optionally as single object or object collection

That was in short what was on my requirement list. I had a few difficulties solving the problem of filling "this" and classes that fill them self in the constructor, but i finally figured it out. public void Fill(ref object[] objCollection ...){    ...    System.Type type = objCollection[0].GetType();    ArrayList arr = new ArrayList();    ...    object baseObject;     // struct or struct[]    if(type.IsValueType)     {        baseObject = type.Assembly.CreateInstance(type.FullName);    }    // this or non serializable class    else if(arr.Count==0)    {        baseObject = objCollection[0];    }    // class or class[]    else if(type.IsSerializable)     {        Stream _stream;        BinaryFormatter _formatter = new BinaryFormatter();        try        {            _stream = File.Open("Empdata.bin",              FileMode.Create, FileAccess.Write);            _formatter.Serialize(_stream, objCollection[0]);            _stream.Close();              _stream = File.Open("Empdata.bin",               FileMode.Open, FileAccess.Read);             object _desObj = _formatter.Deserialize(_stream);             baseObject = Convert.ChangeType(_desObj, type);             _stream.Close();        }        catch(Exception e)        {            throw new Exception(type.ToString() +              " could not be serialized.", e);        }    }    else    {        throw new NotImplementedException(type.ToString() +          " is no value type and don't implements the" +          "ISerializable interface.");    }    ...    arr.Add(baseObject);    ...}

OleDb + DataSet

<%@ Page language="C#" %><script language="C#" runat="server">  private void Page_Load(object sender, System.EventArgs e)  {    System.Data.OleDb.OleDbConnection _conn =      new System.Data.OleDb.OleDbConnection();    _conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" +      "Data Source=D:\\WebRoot\\data\\data.mdb";    System.Data.OleDb.OleDbCommand _cmd = conn.CreateCommand();    _cmd.CommandType = System.Data.CommandType.Text;    _cmd.CommandText = "SELECT Name FROM Users WHERE ID=1";    System.Data.OleDb.OleDbDataAdapter _adapter =      new System.Data.OleDb.OleDbDataAdapter();    _adapter.SelectCommand = _cmd;    System.Data.DataSet _dataset = new System.Data.DataSet();    _conn.Open();    _adapter.Fill(dataset, "UserTable");    _conn.Close();    if(_dataset.Tables["UserTable"].Rows.Count>0)    {      this.TextBox1.Text =        _dataset.Tables["UserTable"].Rows[0][0].ToString();    }  }</script><html><body><form ID="Form" runat="server"> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox></form></body></html>

OleDb + DataReader

<%@ Page language="C#" %><script language="C#" runat="server"> private void Page_Load(object sender, System.EventArgs e) {   System.Data.OleDb.OleDbConnection _conn =     new System.Data.OleDb.OleDbConnection();   _conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" +     "DataSource=D:\\WebRoot\\data\\data.mdb";   System.Data.OleDb.OleDbCommand _cmd = _conn.CreateCommand();   _cmd.CommandType = System.Data.CommandType.Text;   _cmd.CommandText = "SELECT Name FROM Users WHERE ID=1";   _conn.Open();   System.Data.OleDb.OleDbDataReader _reader = cmd.ExecuteReader();   if(_reader.Read())   {     this.TextBox1.Text = _reader.GetString(0);   }   _reader.Close();   _conn.Close();}</script><html><body><form ID="Form" runat="server"> <asp:TextBox id="TextBox1" runat="server"></asp:TextBox></form></body></html>


I just started reading "Developing XML Web Services and Server Components with Microsoft Visual C# .NET and the Microsoft .NET Framework" by Amit and Priti Kalani. According to what Peter Provost (congratulations ;-)) wrote in his blogentry it gives a few good tips and a complete overview of what i can expect in this exam.