20 July 2009

Issues with Creating DAL (Data Access Layer)

Some of the basic issues with creating DAL (Data Access Layer) are shared below.
  • When any TableAdapter is added in a strongly typed DataSet (name: Northwind)
    1. a namespace (name: NorthwindTableAdapters) is created for the TableAdapters in the DataSet.
  • When a TableAdapter (name: Products) is added to a DataSet (name: Northwind)
    1. A DataTable type (name: Northwind.ProductsDataTable) is created in the DataSet
    2. The created DataTable contains a collection of DataRows (name: Northwind.ProductsRow)
    3. A TableAdapter is created in the TableAdapters' namespace (name: NorthwindTableAdapters.ProductsTableAdapter)

  • SCOPE_IDENTITY() function in SQLServer returns the last identity value inserted. Details found here.

  • In case of insert query in TableAdapter, the default 'ExecutionMode' value is 'NonQuery' meaning the query will return the number of afftected rows. The ExecutionMode value 'Scalar' means that the query will return the value actually returned by the query (not number of afftected rows).

15 July 2009

Show/Hide Form Title in Taskbar in C#

The required property is Form.ShowInTaskbar.


Sample:

Form2 f2 = new Form2(); // inherited Form class

f2.ShowInTaskbar = false;

f2.ShowDialog(this);

19 June 2009

php code inside HTML tag

The following code creates list with the elements of an array. The blue colored code segments deserves attention.

<html>
<body>
<?php
$arr = array("Sim","Sum","Shis");
$count = 0;
?>

<ul>
<?php while($count < count($arr)) :?>
<li> <?php echo $arr[$count]; $count++; ?> </li>
<?php endwhile;?>
</ul>

</body>
<html>

15 June 2009

How to disable close button of form

In a Form, you can enable/disable miximize/minimize button control easily by FormObject.MaximizeButton or FormObject.MinimizeButton property. But unfortunately, there is no such property for close button. You can disable the close button by overriding a property in your form class like below.

private const int CP_NOCLOSE_BUTTON = 0x200;

protected override CreateParams CreateParams

{

get

{

CreateParams myCp = base.CreateParams;

myCp.ClassStyle = myCp.ClassStyle | CP_NOCLOSE_BUTTON;

return myCp;

}

}

Note: This procedure works for disabling the close button at the time of form loading, not after loading the form.

 

© 2007 t!ps n tr!cks



Template unik dari rohman


---[[ Skip to top ]]---