sqlclient

Report Viewer - Request for the permission of type SqlClientPermission failed

◇◆丶佛笑我妖孽 提交于 2019-12-01 18:13:21
I am using the ReportViewer control from Visual Studio 2008 in Local Mode with objects as the data source. My classes are mapped to data tables in my database. In the objects, it loads related objects as needed. So it leaves the reference null until you try to use the property, then it tries to load it from the database automatically. The classes use the System.Data.SqlClient namespace. When I interact with the objects in my Windows Forms application, everything works as expected. But when I pass the object to be used as a Report Data Source and it tries to automatically load the related

System.IO.FileNotFoundException with SqlClient

此生再无相见时 提交于 2019-12-01 17:10:25
After fixing my problem as mentioned here I am getting the below exception System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Data.SqlClient, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.' My library is a .NET Standard 1.4 and the WebApp is .NET Framework 4.6.1 System.Data.SqlClient is version - 4.3.0 NuGet package. So I tried doing the below but in vain: <dependentAssembly> <assemblyIdentity name="System.Data.SqlClient" culture="neutral" publicKeyToken="31bf3856ad364e35"/>

Report Viewer - Request for the permission of type SqlClientPermission failed

落爺英雄遲暮 提交于 2019-12-01 17:08:36
问题 I am using the ReportViewer control from Visual Studio 2008 in Local Mode with objects as the data source. My classes are mapped to data tables in my database. In the objects, it loads related objects as needed. So it leaves the reference null until you try to use the property, then it tries to load it from the database automatically. The classes use the System.Data.SqlClient namespace. When I interact with the objects in my Windows Forms application, everything works as expected. But when I

Exception: type initializer for 'system.data.sqlclient.sqlconnection'?

烂漫一生 提交于 2019-12-01 03:17:31
I couldn't figure out what is the problem for this exception. The type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception First attempt: I was using the WCF Service to make some small application. It works just fine and I can use the LINQ properly. After 2 or 3 days. Maybe after I close Visual studio and load the project again. The exception appear. The 2nd attempt also the same. I create another project and it work just fine until I do something else (I do not change any code) SQL Server working fine and I can connect through SQL Management Studio without problem. A

SqlClient error after updating Windows - “The incoming tabular data stream (TDS) remote procedure call > (RPC) protocol stream is incorrect”

本小妞迷上赌 提交于 2019-11-30 20:04:00
Since updating Windows 10 to 1803, I have begun receiving this error anytime I run an EF query that joins against a table-valued function that takes in a scalar parameter. Message: The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 2 (""): Data type 0x00 is unknown. Stack Trace: at System.Data.SqlClient.SqlCommand.<>c.b__180_0(Task1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke() at System.Threading.Tasks.Task.Execute() --- End of stack trace from previous location where exception was thrown --- at

How do I make SqlDataReader.ReadAsync() run asynchronously?

删除回忆录丶 提交于 2019-11-30 14:14:14
问题 When making calls to SQL Server that actually do things that take time, SqlDataReader.ReadAsync() runs synchronously for me. Is there any way to force it to run asynchronously or is my only option to call it in Task.Run() ? Here is a repro. It uses winforms to demonstrate that the call blocks the GUI thread. Note that the T-SQL has to actually do something— this is not reproducible with WAITFOR DELAY '00:00:20' . using System; using System.Configuration; using System.Data.Common; using System

Return value of ExecuteNonQuery after rollback

馋奶兔 提交于 2019-11-30 13:44:14
问题 Assuming that we have a stored procedure that does like something this: BEGIN TRANSACTION UPDATE sometable SET aField = 0 WHERE anotherField = 1; UPDATE sometable SET aField = 1 WHERE anotherField = 2; ROLLBACK TRANSACTION; And from C# we have something like this: using (var connection = new SqlConnection("connection string")) { connection.Open(); var cmd = connection.CreateCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "my_procedure"; var res = cmd

System.Data.EntityException: The underlying provider failed on Commit

痴心易碎 提交于 2019-11-30 11:06:41
Using Entity Framework, I received a number of the following exceptions last night in one of my applications: System.Data.EntityException: The underlying provider failed on Commit. ---> System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() at System.Data.SqlClient.TdsParserStateObject.ReadSniError(TdsParserStateObject stateObj, UInt32

Return value of ExecuteNonQuery after rollback

不想你离开。 提交于 2019-11-30 08:19:44
Assuming that we have a stored procedure that does like something this: BEGIN TRANSACTION UPDATE sometable SET aField = 0 WHERE anotherField = 1; UPDATE sometable SET aField = 1 WHERE anotherField = 2; ROLLBACK TRANSACTION; And from C# we have something like this: using (var connection = new SqlConnection("connection string")) { connection.Open(); var cmd = connection.CreateCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "my_procedure"; var res = cmd.ExecuteNonQuery(); } Why I'm not getting getting res == -1? I'm still getting the number of affected rows. When the

SqlClient error after updating Windows - “The incoming tabular data stream (TDS) remote procedure call > (RPC) protocol stream is incorrect”

限于喜欢 提交于 2019-11-30 03:38:44
问题 Since updating Windows 10 to 1803, I have begun receiving this error anytime I run an EF query that joins against a table-valued function that takes in a scalar parameter. Message: The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 2 (""): Data type 0x00 is unknown. Stack Trace: at System.Data.SqlClient.SqlCommand.<>c.b__180_0(Task1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke() at System.Threading