sqlconnection Questions
1
Solved
I'm doing some experimentation with ADO.Net and EF in order to better understand how it handles the SQL Server connections.
I found something very interesting with ADO.Net. I am creating multiple ...
Wharfinger asked 4/3, 2018 at 1:58
2
Solved
My Azure Function App has a ConnectionString defined. I want to retrieve it from a C# function written in dotnet standard 2.0. I have tried adding System.Configuration.ConfigurationManager to the p...
Lavery asked 1/1, 2018 at 8:3
1
Solved
I have the code below, I have read Moq and SqlConnection? and How can I stub IDBconnection, but I still have no idea how to mock the following sqlconnection.
public class SqlBulkWriter : ISqlBulkW...
Such asked 24/1, 2018 at 2:4
5
Solved
I have a method ("GetDataReader," let's call it) that returns a SqlDataReader. It's inside a Singleton DataFactory class that maintains a persistent connection to the database.
The problem with th...
Gardening asked 18/1, 2010 at 15:22
2
Solved
What is the difference between using connection.OpenAsync() and connection.Open() when using dapper's QueryAsync method.
Async:
public async Task<IList<Product>> GetListAsync()
{
us...
Peres asked 18/10, 2017 at 2:33
4
Solved
I have a temporal table Employee with EmployeeHistory as its history table.
In C#, I am using SqlConnection to query the data from SQL Server for the entire history of an employee.
var data = Con...
Squeaky asked 17/7, 2017 at 12:19
6
I got very weird ArithmeticOverflowException when opening an SQL connection to the underlying SQL database (stack trace included below). It doesn't make a difference which version of the server is ...
Anagram asked 16/9, 2015 at 12:49
3
Solved
What does it mean for an SqlConnection to be "enlisted" in a transaction? Does it simply mean that commands I execute on the connection will participate in the transaction?
If so, under what circu...
Bilbao asked 21/5, 2010 at 19:13
2
This is my first post. help me. how to bind datatable to webgrid?
My code:
SqlConnection con = new SqlConnection(CS);
SqlCommand cmd = new SqlCommand("select * from candidate", con);
SqlDataAdapt...
Pyemia asked 28/8, 2013 at 13:54
0
Within a request on an ApiController, I'm tracking the duration of awaiting the Sql Connection to open.
await t.TrackDependencyAsync(async() => { await sqlConnection.OpenAsync(); return true; }...
Pedantry asked 24/2, 2017 at 8:28
3
I'm seeing the following error when attempting to open a DB connection from within my C# application. I realize this error has probably shown up on 100's of questions before. However, in this scena...
Aubin asked 11/7, 2013 at 22:1
2
Solved
I'm attempting to use CryptUnprotectData to read a password protected using CryptProtectData into a SecureString and use that to connect to a database. I can get the correct password out, but tryin...
Gala asked 20/12, 2016 at 11:53
2
Solved
I am developing a C# windows form application containing a service based data based. when I test my application it's database works fine but after publishing and installing the program when program...
Sideward asked 15/10, 2016 at 19:6
2
I have the following code:
class Program
{
static void Main()
{
var connection = new SqlConnection("myConnectionString");
connection.Open();
connection.StateChange += HandleSqlConnectionDrop...
Wifeless asked 25/5, 2016 at 16:32
3
Solved
For performance considerations I am using SqlConnection and SqlReaderStream for returning a byte[] stream from a SQL Server database:
private static SqlConnection GetConnection()
{
var sqlConnect...
Ctenoid asked 28/7, 2015 at 13:6
1
If I open a SqlConnection to a SQL Server, and then issue multiple queries from multiple background threads, all using that one connection - will those queries be executed sequentially (don't care ...
Mince asked 22/7, 2015 at 15:32
1
Solved
In C# it is possible to enable/disable Connection Pooling by using "Pooling=True" and "Max Pool Size=XY" in connection string.
Like: What is maximum allowable value of "Max Pool Size" in...
Expansion asked 11/8, 2014 at 21:56
3
Solved
I am generating some Dynamic SQL and would like to ensure that my code is safe from SQL injection.
For sake of argument here is a minimal example of how it is generated:
var sql = string.Format("...
Hydrograph asked 11/3, 2012 at 1:9
3
Solved
Which of the following two examples are correct? (Or which one is better and should I use)
In the MSDN I found this:
private static void ReadOrderData(string connectionString)
{
string queryStri...
Moonmoonbeam asked 7/2, 2013 at 16:12
5
Solved
I've come from Java experience and am trying to start with C#. I've read SqlConnection SqlCommand SqlDataReader IDisposable and I can understand that the best practice to connecting to a DB is wrap...
Mckoy asked 29/12, 2014 at 15:57
3
Solved
Currently my code is constructed as follows.
using (var sqlCon = new SqlConnection(Context.ReturnDatabaseConnection()))
{
sqlCon.Open();
try
{
//Code here
}
catch (Exception e)
{
...
Photostat asked 3/11, 2014 at 3:44
2
Solved
I have a ton of rather working code that's been here for months and today I saw the following exception logged:
System.InvalidOperationException
SqlConnection does not support parallel transaction...
Bigford asked 24/10, 2013 at 7:34
3
I have following code. the call to connection.OpenAsync() quits the program without any exception. Even the finally on the caller method is not invoked. program is targetting .NET45 Any idea?
Upd...
Seaddon asked 13/2, 2014 at 2:47
3
Solved
Dapper implicitly expects a connection to be open when it uses it. Why doesn't it open and close it itself? Wouldn't this simply connection management?
I ask because a co-worker and I have been go...
Epps asked 27/9, 2012 at 19:47
1
Solved
I have a Log class which put logs in Windows journal and in a SQL table. In order to optimize my code, I would like use only one SqlConnection.
In MSDN, it says: Any public static (Shared in Visua...
Montoya asked 12/2, 2014 at 15:6
© 2022 - 2024 — McMap. All rights reserved.