Browse by Tags
Sorry, but there are no more tags available to filter with.
-
-
When calling execute Scalar, we always begin by calling it with some code like int i = cmd.ExecuteScalar(); What’s wrong with this picture?… what if, the first field of the first row is… NULL? so… int i; object o = cmd.ExecuteScalar(); if(o != null) ...
-
-
Embedding SQL statement is sometimes useful. A good practice is to centralize them in a class, using public constants... public const string SQL_MYTABLE_INSERT = "INSERT MYTABLE (FIELD) VALUES (@FIELDVALUE)"; -f.
-
-
A dataset is a set of data, but when you want to query multiple one, you might want to return a ResultSet that is a combination of multiple table inside your dataset. They can have references or simple no link between them... be return is a single call...
-
-
A connection can be open, and closed at each time, but a better way to use them is to open one, and query everything in the using. Do not forget that you can only do that when you are NOT using Datareader! An exclusive connection is required in that case...
-
-
TCP/IP and Named Pipe can be used as SQL Connections, but when to use one or the other. TCP/IP seams to be more efficient on slower network, and on fast one, both are comparable. -f. ref: http://msdn.microsoft.com/en-us/library/aa178138(SQL.80).aspx
-
-
Yes... This is a good question. When you use AddWithValue, you just relying on the implicit SQL conversion between a nvarchar(4000) and the real datatype... So, I’m returning the question to you: is it good, in your case? -f.