Browse by Tags
All Tags »
ADO.NET (
RSS)
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...
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...
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...
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...
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...
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....
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...
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...