-
-
Save EgorBo/dcc961e82b4ad0a8aed9772d24be9cd6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Data.SqlClient; | |
namespace Test | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var sqlCommandLength = 1024*16; // 702 works as expected, 703 does not. | |
var connectionString = "Server=10.0.75.1;Database=testo;User Id=sa;Password=qwerty123;"; | |
var sql = new string(';', sqlCommandLength); | |
foo(connectionString, sql); | |
Console.WriteLine("End2"); | |
} | |
static void foo(string connectionString, string sql) | |
{ | |
using (var dbcon = new SqlConnection(connectionString)) | |
{ | |
dbcon.Open(); | |
using (var dbcmd = dbcon.CreateCommand()) | |
{ | |
dbcmd.CommandText = sql; | |
using (var reader = dbcmd.ExecuteReader()) | |
{ | |
while (reader.Read()) { } | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment