Filed under Ado.Net

Truly amazing! SQLCE truncates parameters

Recently I got a bug report in SisoDb where a document got truncated hence when getting deserialized back the deserialization process blow up. After a short investigation I found this truly amazing bug in SQLCe4. If you have a field being “nvarchar(4000)” and you use a command parameters that has a value being 4001 chars … Continue reading »

C# – Custom datareader for SqlBulkCopy

When prototyping SisoDb I used datatables under the covers when consuming the SqlBulkCopy class to insert data. This lead to that I had the source entities in memory as well as the datatables. Since the SqlBulkCopy class can work with readers I created a very simple datareader implementation over my entities instead. I gained a … Continue reading »

C# – Batch identity inserts

Updated! Now contains a second version which will return all id’s if you are uncertain of how table locks and row locks will be handled. NOTE! You really should think twice before using this kind of code. What you should do instead is to at least try to use the SqlBulCopy class instead. Of course … Continue reading »