DCSIMG
ADO.NET - Wortzel's blog

Wortzel's blog

.Net (2.0, 3.0, 3.5), C#, Asp.net, Com+, GIS(ESRI Software), Management, Analysis & Design, Life, Trips, And more...

Browse by Tags

All Tags » ADO.NET (RSS)
5 things you should know about SqlBulkCopy
SqlBulkCopy in a new powerful feature in ADO.NET 2.0 which let you to load large amount of data into Sql Server table. It provides you the same functionality as the bcp command-line, with significant performance advantage. Furthermore, all this occurs in standard manage code! In order to use the SqlBulkCopy you must use Sql Server Table as a target table. But in the source, you can use any source which can loaded into DataTable or to implement the IDataReader interface. The SqlBulkCopy class has...

Posted Wednesday, February 27, 2008 8:39 AM by Avi Wortzel | 1 comment(s)

Working with large objects
In SQL server 2005 you have some options to work with large objects. If the data is binary you should use the Binary Large Object (BLOB), and if the data is textual you should use the Character Large Object (CLOB). The BLOB objects and the CLOB objects have a capacity of 2^127 bytes. When you are dealing with a large object you should ask yourself: Isn’t this object to big to load it from the memory? If the object is too big you should consider using a streaming method. When using a streaming method...

Posted Monday, May 21, 2007 11:17 PM by Avi Wortzel | 7 comment(s)

Transactions in .Net v2.0 (Distribute and local)
What is a transaction , in one word? ACID . A tomicity: One block that can't be broken into smaller parts. C onsistency: Works on consistent view and leaves the DB in a constituently state. I solation: Effects only the transaction. D urability: Writes the committed transactions to the database. Single transaction vs. Distributed transactions: Single transaction – a transaction that works on only one durable resource and on a single open connection (also called local lightweight transaction).These...

Posted Friday, May 11, 2007 9:45 AM by Avi Wortzel | 1 comment(s)

Building the image engine
In our project we had a dilemma if we should store image files in database or in file system directory. There are some pros' and cons' for each option, but the most important issue that influenced our decision was that we work with ESRI tools. If the image is small it's better to store it in the file system and not in the database. If we store the image in database (using SDE ), it will takes some time and this operation couldn't be in real-time reaction (because the SDE will create a pyramids and...

Posted Thursday, April 05, 2007 11:57 PM by Avi Wortzel | 4 comment(s)

Types of primary keys
There are three approaches to implement a primary key: Natural key: 1. A column or collection of columns that define the table uniqueness (existing column\columns from data table). Surrogate primary key: an auto-generated keys without any business relationship: 2. Auto-increment column (Aka sequence) that store in an ID column. 3. Auto-generated key using the Global Unique Identifier(GUID). No. Subject Natural primary key Sequence key GUID key 1 Extra data size(tables and indexes) Big index data...

Posted Monday, April 02, 2007 12:22 AM by Avi Wortzel | with no comments

Synchronous vs. Asynchronous access
When commands are executed synchronously, the thread is waiting for a response from the database server and it is getting into a blocking state (until the command is finishing to be executed). protected void ExecuteCommandInSynchronousAccess() { using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); using (SqlCommand command = connection.CreateCommand()) { command.CommandText( "UPDATE CUSTOMERS SET NAME='Yuval'" ); // Processing the command on the SQL server....

Posted Friday, March 30, 2007 5:40 PM by Avi Wortzel | with no comments

Connection pooling in ADO.NET 2.0
Creating and opening a connection to a database is very expensive operation (In time & resource). To handle that problem we should use connection pooling that holds a number of existing connections. Each connection pooling has a minimum pool size and maximum pool size. The minimum pool size is use to determine the minimum number of connection that the pool must hold, and the maximum pool size define the maximum connection that the pool can hold at the same time. If the pool reaches to maximum...

Posted Wednesday, March 28, 2007 12:00 AM by Avi Wortzel | with no comments

ADO.NET Classes
I started to read the book "Programming Microsoft ADO.NET 2.0 applications Advanced topics", and I want to share you with a short summary that I wrote. DataSet: Memory based relational representation of data (or cache data) without any transaction properties. Typed DataSet comes to improve the regular DataSet to a stronger type (it gets the errors in a compile time, the VS IntelliSense helps to reduce incorrect spelling). The creation is manually or by XSD (XML schema definition) file. Serialization...

Posted Monday, March 12, 2007 1:32 AM by Avi Wortzel | with no comments