What ‘length’ parameter should I pass to SqlDataReader.GetBytes()

When dealing with varbinary(max), there are two scenarios: the length of the data is moderate the length of the data is big GetBytes() is intended for the second scenario, when you are using CommandBehaviour.SequentialAccess to ensure that you are streaming the data, not buffering it. In particular, in this usage you would usually be writing … Read more

ADO.NET calling T-SQL Stored Procedure causes a SqlTimeoutException

Once I determined that it is the ADO.NET connection at the root of the problem, this thread led me to the answer. Basically connections through Sql Server Management Studio (SSMS) by default have SET ARITHABORT ON. ADO.NET connections do not. Setting ARITHABORT OFF and executing the query directly through SSMS gives me the same slow … Read more

How do I extract data from a DataTable?

The DataTable has a collection .Rows of DataRow elements. Each DataRow corresponds to one row in your database, and contains a collection of columns. In order to access a single value, do something like this: foreach(DataRow row in YourDataTable.Rows) { string name = row[“name”].ToString(); string description = row[“description”].ToString(); string icoFileName = row[“iconFile”].ToString(); string installScript = … Read more