August 29, 2006
@ 09:20 PM

ComponentArt is a very good component for

but it still has some bugs when use it in 2.0

the tab and menu component lost its css style after the page's  postback event. 



August 24, 2006
@ 11:12 PM

IBM Developerworks has just published Ron Bodkin's new article about how to apply aspect-oriented programming. If you are interested in AOP and want to know how to really use it, this article can help.


NHibernate Step by Step (一) Hello,NHibernate!


nhibernate_template.rar (9.17 KB)

for Mysql,

provide Type use ADOXSchemaProvider

connection String:

DRIVER={MySQL ODBC 3.51 Driver};;PORT=3306;DATABASE=myDatabase; USER=myUsername;PASSWORD=myPassword;OPTION=3;


test passed but generating failed..

Helpful tools related to NHibernate

  • HQL Analyzer and hbm.xml GUI Editor
  • ObjectMapper by Mats Helander is a mapping GUI with NHibernate support
  • MyGeneration is a template-based code generator GUI. Its template library includes templates for generating mapping files and classes from a database.
  • AndroMDA is an open-source code generation framework that uses Model Driven Architecture (MDA) to transform UML models into deployable components. It supports generation of data access layers that use NHibernate as their persistence framework.
  • CodeSmith Template for NH
  • NHibernate Helper Kit is a VS2005 add-in to generate classes and mapping files


Categories: nHibernate

Categories: nHibernate

August 8, 2006
@ 10:53 PM
1. Download log4net from
2. For ASP.NET 2.0, find log4net.dll from folder:\log4net-1.2.10\bin\net\2.0\release
    and add to project by add reference.
3. In Globle.asax, add this line:
  void Application_Start(object sender, EventArgs e)
        // Code that runs on application startup

4. In web.config file after <configuration>, add
        <section name="nhibernate" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
        <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>

and add this at buttom before</configuration>
<!-- This section contains the log4net configuration settings -->
        <appender name="FileAppender" type="log4net.Appender.FileAppender">
            <file value="log-file.txt" />
            <appendToFile value="true" />
            <layout type="log4net.Layout.PatternLayout">
                <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
            <level value="DEBUG" />
            <appender-ref ref="FileAppender" />

Notice the appender-ref's value same as appender type.
more different config can get from here Config Examples
and here Configuration

5 In your code where need log,
using log4net;
private static readonly ILog log = LogManager.GetLogger(typeof(<ClassName>));

other ref:

log4net fileappender configure looks not working.

Categories: log4net

    <asp:GridView ID="gvGraveOpening" runat="server" AutoGenerateColumns="False" DataKeyNames="Id"
        DataSourceID="GraveOpeningODS"  OnRowUpdating="grGraveOpening_rowUpdateing" SkinID="mocha"
            <asp:HyperLinkField DataNavigateUrlFields="Id" DataNavigateUrlFormatString="~/Funeral/GraveOpeningDetail.aspx?id={0}"
                Text="Detail" />
            <asp:BoundField DataField="Name" HeaderText="Name" ReadOnly="True" />
            <asp:BoundField DataField="Grave" HeaderText="Grave" ReadOnly="True" />
            <asp:BoundField DataField="DateTime" HeaderText="DateTime" ReadOnly=True />
            <asp:TemplateField HeaderText="Status">
                    &nbsp;<asp:DropDownList ID="ddlStatus" runat="server" >
                        <asp:ListItem Selected=True>Issued</asp:ListItem>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("status") %>'></asp:Label>
            <asp:CommandField ShowEditButton="True" EditText="Update Status" ButtonType="Button" UpdateText="Save"  />
    <asp:ObjectDataSource ID="GraveOpeningODS" runat="server" SelectMethod="UnCompeltedGraveOpening"
        TypeName="GraveOpeningDs" UpdateMethod="SaveGraveOpeningStatus">


Code Behind:

protected void grGraveOpening_rowUpdateing(object sender, GridViewUpdateEventArgs e)
        DropDownList d= (DropDownList)gvGraveOpening.Rows[e.RowIndex].FindControl("ddlStatus");
        GraveOpeningDs ds = new GraveOpeningDs();
        ds.SaveGraveOpeningStatus(Convert.ToInt32(e.Keys[0]), d.SelectedValue);




step 1, Preparing Object Datasource:


public class UserDS
public ArrayList GetUsers(object login_user)
if user is admin return all users, otherwise return login_user in Arralist
return DBControl.GetDashboardUsers((User)login_user);
public void SaveUser(string username, string password, string group)
DBControl.UpdateUser(username, password, group);
public void InsertUser(string username, string password, string group)
//if username exsit, then throw excepton..
DBControl.InsertUser(username, password, group);

public void Deleteuser(string username)

step 2, Create Object Datasource In Asp page:

<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="Deleteuser"
SelectMethod="GetUsers" TypeName="UserDS" UpdateMethod="SaveUser">
<asp:Parameter Name="UserName" Type="String" />
<asp:Parameter Name="UserName" Type="String" />
<asp:Parameter Name="Password" Type="String" />
<asp:Parameter Name="Group" Type="String" />
<asp:SessionParameter Name="login_user" SessionField="Login_User" Type="Object" />


step 3, GridView:

<asp:GridView ID="GridView1" runat="server" BackColor="White" BorderColor="#E7E7FF"
BorderStyle="None" BorderWidth="1px" CellPadding="3" DataSourceID="ObjectDataSource1"
GridLines="Horizontal" AutoGenerateColumns=False DataKeyNames="UserName">
<FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
<asp:BoundField DataField="UserName" HeaderText="UserName" ReadOnly=true />
<asp:BoundField DataField="Password" AccessibleHeaderText="Password" HeaderText="Password" />
<asp:BoundField DataField="Group" HeaderText="Group" />
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
<RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
<PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
<AlternatingRowStyle BackColor="#F7F7F7" />

Categories: | C#

Performance Limitations in SQL Server Express

The SQL engine of SQL Server Express supports 1 CPU, 1 GB RAM and a 4 GB database size. This distinction gives SQL Server Express well defined cut-off points to differentiate it from other SQL Server 2005 editions. Unlike MSDE, SQL Server Express eliminates the confusion created by the workload governor.

1 CPU: SQL Server Express can install and run on multiprocessor machines, but only a single CPU is used at any time. This limitation prevents the use of parallel query execution in SQL Server Express.

1 GB RAM: The 1 GB RAM limit is the memory limit available for the buffer pool. The buffer pool is used to store data pages and other information. However, memory needed to keep track of connections, locks, etc. is not counted toward the buffer pool limit. It is therefore possible that the server will use more than 1 GB in total, but it will never use more than 1GB for the buffer pool. This limitation prevents the use of Address Windowing Extensions (AWE) with SQL Server Express.

4 GB Database Size: The 4 GB database size limit applies only to data files and not to log files. However, there are no limits to the number of databases that can be attached to the server. There are some minor changes to the startup of SQL Server Express. User databases are not automatically started, and DTC is not automatically initialized. For the user experience, though, there should be no difference other than a faster startup. Applications planning to use SQL Server Express are recommended to keep these changes in mind when designing their applications.

Limitation in Enterprise Features

The following SQL Server 2005 enterprise level features are not available in SQL Server 2005 Express Edition:

  • Analysis Services (both OLAP and Data Mining)
  • Integration Services (DTS successor)
  • Notification Services
  • Report Builder (although Reporting Services is included)
  • SQL Agent (See Teratrax Job Scheduler)
  • Database Tuning Advisor
  • Full-text search
  • Log shipping

Enterprise Availability Limitations

Unlike other editions of SQL Server 2005, the Express edition does not support Fail-over Clustering or Database Mirroring.

Database Mirroring: Database Mirroring extends log shipping capabilities and enhances availability of SQL Server systems by providing automatic fail-over to a standby server.

Fail-over Clustering: Fail-over clustering is the ultimate fail-over mechanism SQL Server can provide. A SQL Server node in a cluster of nodes sharing one disk array can fail-over to another node without affecting the availability of the server cluster. The disk array where databases reside is central to the SQL Server cluster.

Networking Support in SQL Server 2005 Express

Only the shared memory on the local machine is accessible by default for SQL Server Express, although the user can explicitly turn on other supported protocols such as TCP/IP and Named Pipes. VIA and HTTP protocols are not supported in SQL Server Express. With only shared memory available by default, connections from a remote machine to SQL Server Express will fail unless the networking is turned on. To turn networking on, Use SQL Computer Manager to enable relevant protocols and start SQL Browser.

SQL Browser is a new service in SQL Server 2005 that is used to identify the ports that named instances listen on. Since shared memory does not use it, this service is turned off in SQL Server Express by default. This means that the user will have to start this service so that network access can work.

Note One interesting fact is that SQL Browser listens on UDP port 1434. However, pre-SP3 versions of SQL Server 2000 holding port UDP 1434 may result in failure of SQL Browser name resolution, since they may refuse to give up the port. The workaround is to upgrade all SQL Server 2000/MSDE instances on the machine to SP3 or higher.

Categories: SQL Server 2005

In Sqlserver 2005, database can very easy to attached with project and distribute to other,

For a website use Sqlserver Express, your database file may be in you app_data folder, in you web.config, it defined like this:

<add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />

But if you use a remote database server, you have to attach the database file to the databaser server.

First copy the mdf file and ldf file to database server, for production database, mdf and ldf file used to in diffenent disk.

Then run below T-Sql scripts to attach database.

USE master;
ON (FILENAME = 'C:\Projects\MyProject\App_Data\ASPNETDB.MDF'),
(FILENAME = 'C:\Projects\MyProject\App_Data\aspnetdb_log.ldf')


In SQL Server Management Studio, a newly attached database is not immediately visible in Object Explorer. To view the database, in Object Explorer, click View, and then Refresh. When the Databases node is expanded in Object Explorer, the newly attached database now appears in the list of databases.

For Detactch a Database:
Detach the AdventureWorks database by executing the following Transact-SQL statements:


USE master;
EXEC sp_detach_db @dbname = N'AdventureWorks';

Categories: SQL Server 2005

Got this from Scott Guthrie's blog:

Now one annoying gotcha:


There is one gotcha to be aware of, though, that can sometimes cause intellisense for the web.config file to stop working in the IDE.  This happens when a default namespace is added to the root <configuration> element.  For example, like so:


            <configuration xmlns="">


This doesn’t cause any runtime problems – but it does stop intellisense completion happening for the built-in .NET XML elements in the web.config file. 


The bad news is that the built-in web admin tool (launched via the WebSite->ASP.NET Configuration menu item in VS 2005 and Visual Web Developer) always adds this xmlns namespace when it launches – so if you use this tool to manage users/roles you’ll end up having it added to your web.config file for you.


How to fix this gotcha:


To get intellisense back when you are editing the web.config file in the IDE, just delete the xmlns reference and have the root configuration element look like so:




Everything will then work fine again.

Ref Link:

Categories: VS 2005