Skip to main content

Posts

Showing posts from July, 2010

SQL Bulk Copy with C#.Net

Bulk copying of data from one data source to another data source is a new feature added to ADO.NET 2.0. Bulk copy classes provides the fastest way to transfer set of data from once source to the other. Each ADO.NET data provider provides bulk copy classes. For example, in SQL .NET data provider, the bulk copy operation is handled by SqlBulkCopy class, which is described in Figure 1. As you can see from Figure 1, data from a data source can be copied to one of the four types - DataReader, DataSet, DataTable, or XML.



Figure 1. Bulk Copy operation in ADO.NET 2.0
Using bulk copy operation, you can transfer data between two tables on the same SQL Server, between two different SQL Servers, or even two different types of database servers.





using System.Data.SqlClient; public static void CopyData(DataTable sourceTable, SqlConnection destConnection, SqlTransaction destTrans, string destTableName) { // new method: SQLBulkCopy: using (SqlBulkCopy s = new SqlBulkCopy(destConnec…

ASP.NET DropDownList with OptionGroup support

ASP.NET 2.0, for all its bells and whistles, lacks the odd bit of functionality for reasons completely unknown. One such notable omission is that of OptionGroup (<optgroup>) support in the DropDownList control. For those unfamiliar with the <optgroup> element, it is part of the XHTML standard, and has the effect of categorising items in a <select>, as the following image shows.

Control Adapters are new in ASP.NET 2.0, and allow the developer to override the rendering behavior of any control, very powerful stuff! Furthermore, Control Adapters are used in conjunction with a browser file, so specific browsers may be targeted, if required. Armed with that knowledge, the solution became simple. The attached download contains the requisite files to implement this solution in your own projects, but for posterity, I paste it here also.
public class DropDownListAdapter : System.Web.UI.WebControls.Adapters.WebControlAdapter { protected override void RenderContents(Ht…

Configure IP Address and Other Network Information in Windows 7

Configure IP Address and Other Network Information in Windows 7
Let me show you how to configure IP address and other network information in Windows 7 here. As you know IP address must be configured on computer in order to communicate with other computers, because this IP address is the standard address understood by computers and other networking devices in networking world. You can configure IP address, subnet mask, gateway and DNS servers manually on computer, but you can also configure computer to obtain IP address and other network information from DHCP server (most of the time is configured on router).
Without wasting any more time, let me show you quick way to do it:
1) Go to Start and click on Control Panel.
2) Proceed to click View network status and tasks in Control Panel window.




3) Network and Sharing Center window will appear, then click change adapter settings.




4) Network Connections window will appears. Here you can right click on the network adapter (can be wireless adapte…

Running 32-bit Server Applications on 64-bit Machines

Running 32-bit Applications on 64-bit Windows (IIS 6.0)
Windows Server 2003™, Service Pack 1 enables IIS 6.0 to run 32-bit Web applications on 64-bit Windows using the Windows-32-on-Windows-64 (WOW64) compatibility layer. IIS 6.0 using WOW64 is intended to run 32-bit personal productivity applications needed by software developers and administrators, including 32-bit Internet Information Services (IIS) Web applications. On 64-bit Windows, 32-bit processes cannot load 64-bit DLLs, and 64-bit processes cannot load 32-bit DLLs. If you plan to run 32-bit applications on 64-bit Windows, you must configure IIS to create 32-bit worker processes. Once you have configured IIS to create 32-bit worker processes, you can run the following types of IIS applications on 64-bit Windows: •Internet Server API (ISAPI) extensions •ISAPI filters •Active Server Page (ASP) applications (specifically, scripts calling COM objects where the COM object can be 32-bit or 64-bit) •ASP.NET applications IIS can, by default…