sqlconnection Questions
4
Solved
I've never used the "appSettings" before. How do you configure this in C# to use with a SqlConnection, this is what I use for the "ConnectionStrings"
SqlConnection con = new SqlConnection();
con.C...
Avaricious asked 15/8, 2011 at 19:46
1
Solved
Problem: I have a form with text values, and a function that must return a string query based on the values of the text values too.
Solution: I created a SQLCommand query with parameters, then I p...
Once asked 5/7, 2011 at 10:54
2
Solved
I've just started using Dapper for a project, having mostly used ORMs like NHibernate and EF for the past few years.
Typically in our web applications we implement session per request, beginning a...
Explain asked 1/6, 2011 at 13:24
5
Solved
Here's my test code, which seems to suggest that it's better to connect multiple times instead of connecting just once.
Am I doing something wrong?
int numIts = 100;
Stopwatch sw = new Stopwatch(...
Perfect asked 12/5, 2011 at 16:36
1
Solved
I have a distributed transaction context using ServiceDomain. Inside it, I open an SQL connection with connection string specifying Enlist=false, so that it is not automatically enlisted in the tra...
Trombone asked 12/4, 2011 at 9:51
2
Solved
I am giving the new Dapper Micro ORM released by Stack Overflow/Sam Saffron a quick go using MVC. I'm wondering what is the simplest way to manage a SQLConnection object inside my controller? I am ...
Salomo asked 19/4, 2011 at 13:31
1
Solved
I wonder, what is the reason to have this SqlCommand constructor overload:
public SqlCommand(
string cmdText,
SqlConnection connection,
SqlTransaction transaction
)
?
When I need to create a...
Cho asked 25/10, 2010 at 11:0
3
Solved
Can anyone brief me how to do Connection Pooling in ADO.Net, I do need to connect to 3 separate databases. 2 of them are in same server and the other in a separate one.
Better with code snipts..
Benedix asked 16/12, 2010 at 6:7
2
Solved
Possible Duplicate:
How to check if connection string is valid?
Currently I'm doing it like this:
internal bool CheckConnection()
{
using (SqlConnection testConn = new SqlConnection...
Winfrid asked 2/12, 2010 at 17:11
7
Solved
I use the using statement for SqlConnection. It's is good for performance because forces calling Dispose() that simply releases the connection to the pool sooner.
However, I realized that object c...
Substituent asked 3/9, 2010 at 12:49
1
Solved
Disclaimer: I know IDisposable should be implemented when dealing with unmanaged resources. The rest of the code should be deterministic and do using (...) { } (equivalent of try {} finally { Dispo...
Necrosis asked 3/9, 2010 at 16:7
2
Solved
I created a sqlconnection, CN1. Then this CN1 is opened. Later in the code there is a transactionscope. If I execute a sql command on this CN1 connection, is this within transaction?
Code looks li...
Allegory asked 29/12, 2009 at 19:45
2
Does it make a difference whether I use SQLCommand/SQLConnection instead of OleDbCommand/OleDbConnection. Do I get any advantages out of that, from a API comfortability, feature, performance or sec...
Bove asked 16/2, 2010 at 14:37
6
When using SqlConnection, it's important to always close it when used - either by .Close() or placing the SqlConnection in a "using". Unfurtunately, people, including myself, tend to forgot that an...
Clea asked 29/6, 2010 at 18:17
6
Solved
I have a simple static class with a few methods in it. Each of those methods open a SqlConnection, query the database and close the connection. This way, I am sure that I always close the connectio...
Alive asked 14/5, 2009 at 4:27
2
Solved
I am using ADO.NET (.NET 1.1) in a legacy app. I know that DataAdapter.Fill() opens and closes connections if the connection hasn't been opened manually before it's given to the DataAdapter.
My qu...
Menu asked 18/3, 2010 at 19:41
4
Solved
How can maintain a SqlConnection (or using another component) open (connected) always during the execution of my .Net app?
I need this because my app needs to detect using this commnad
exec sp_w...
Mano asked 16/3, 2010 at 3:29
3
Solved
Greetings, I would like to ask if creating Singleton to have only one active connection to db is a good idea. What i would like to do is:
1) I have a wcf service
2) wcf service gets data from db
3)...
Citadel asked 4/3, 2010 at 19:10
3
Solved
Is it a must to close the connection in PHP script?
Writeoff asked 11/2, 2010 at 11:30
3
Solved
Background:
I have an application that I have nicely separated my interface logic from my middle tier logic which handles the queries to the database. I do a lot of custom sorting and narrowing so...
Haiti asked 2/2, 2010 at 22:42
6
Solved
This seems to be a simple question, but I wonder the disadvantages of not calling the "close()" function.
Poetry asked 26/1, 2010 at 12:57
4
Solved
In an answer to a previous question somebody recommended:
have the SqlConnection a member variable of your class, but make the class IDisposable and dispose of the SqlConnection when the class i...
Picasso asked 7/1, 2010 at 13:28
3
Solved
A while back I wrote an ORM layer for my .net app where all database rows are represented by a subclass of DatabaseRecord. There are a number of methods like Load(), Save() etc. In my initial imple...
Pastorate asked 7/1, 2010 at 11:48
8
Solved
Per my other question here about Disposable objects, should we call Close() before the end of a using block?
using (SqlConnection connection = new SqlConnection())
using (SqlCommand command = new ...
Gainer asked 28/7, 2009 at 18:21
5
Solved
Given the method:
internal static DataSet SelectDataSet(String commandText, DataBaseEnum dataBase)
{
var dataset = new DataSet();
SqlConnection sqlc = dataBase == DataBaseEnum.ZipCodeDb
? new ...
Hedvige asked 12/10, 2009 at 3:34
© 2022 - 2024 — McMap. All rights reserved.