sqlclient

Could not load file or assembly error in .Net Standard 2.0 class library

╄→гoц情女王★ 提交于 2019-11-30 01:17:21
问题 I have a .NET Standard 2.0 class library project with installed Nuget package System.Data.SqlClient version 4.4.0 and a Windows Form .NET Framework 4.7 project that has a reference to that class library. Installing the Nuget Package and building the solution is successful. but in runtime every time that the code reaches a method that has any thing from SqlClient assembly inside it (for example an instance from SqlConnection) it gets this error: Could not load file or assembly 'System.Data

C# Update Table using SqlCommand.Parameters ASP.NET [duplicate]

╄→гoц情女王★ 提交于 2019-11-29 13:02:49
Possible Duplicate: C# Update Table using SqlCommand.Parameters I'm trying to update an SQL Server table using SqlCommand, I think it's a syntax error with my T-SQL, but here is what I have so far: SqlCommand sqlCmd = new SqlCommand( "UPDATE yak_tickets SET email = @emailParam, subject = @subjectParam, text = @textParam, statusid = @statusIDParam, ticketClass = @ticketClassParam WHERE id = @ticketIDParam", sqlConn); The parameters are working as they should, however, the table never gets updated when I run the code. Any help would be appreciated =) Here is the rest of the code: #region

How to display database records in asp.net mvc view

心已入冬 提交于 2019-11-28 17:59:26
Using ASP.NET MVC with C#, how do you pass some database records to a View and display them in table form? I need to know how I can transfer/pass some rows of records from a database that have been returned to an SqlDataReader object and pass that object to the View so I can display all the records contained by the object in the View using foreach. The following code is what I'm I'm trying to do. But its not working. The Controller: public ActionResult Students() { String connectionString = "<THE CONNECTION STRING HERE>"; String sql = "SELECT * FROM students"; SqlCommand cmd = new SqlCommand

SqlCommand() ExecuteNonQuery() truncates command text

寵の児 提交于 2019-11-28 13:18:18
I'm building a custom db deployment utility, I need to read text files containing sql scripts and execute them against the database. Pretty easy stuff, so far so good. However I've encountered a snag, the contents of the file are read successfully and entirely, but once passed into the SqlCommand and then executed with SqlCommand.ExecuteNonQuery only part of the script is executed. I fired up Profiler and confirmed that my code is not passing all of the script. private void ExecuteScript(string cmd, SqlConnection sqlConn, SqlTransaction trans) { SqlCommand sqlCmd = new SqlCommand(cmd, sqlConn,

C# Update Table using SqlCommand.Parameters ASP.NET [duplicate]

删除回忆录丶 提交于 2019-11-28 06:44:28
问题 Possible Duplicate: C# Update Table using SqlCommand.Parameters I'm trying to update an SQL Server table using SqlCommand, I think it's a syntax error with my T-SQL, but here is what I have so far: SqlCommand sqlCmd = new SqlCommand( "UPDATE yak_tickets SET email = @emailParam, subject = @subjectParam, text = @textParam, statusid = @statusIDParam, ticketClass = @ticketClassParam WHERE id = @ticketIDParam", sqlConn); The parameters are working as they should, however, the table never gets

How to use SqlClient in ASP.NET Core?

ε祈祈猫儿з 提交于 2019-11-28 05:11:25
I am trying to use SQLClient library in the ASP.net Core but cant seem to get it working. I found this article online advising how to setup but its not working for me: http://blog.developers.ba/using-classic-ado-net-in-asp-net-vnext/ I have a simple console application package. My project.json looks like this: { "version": "1.0.0-*", "description": "DBTest Console Application", "authors": [ "" ], "tags": [ "" ], "projectUrl": "", "licenseUrl": "", "compilationOptions": { "emitEntryPoint": true }, "dependencies": { "System.Data.Common": "4.0.1-beta-23516", "System.Data.SqlClient" : "4.0.0-beta

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

老子叫甜甜 提交于 2019-11-28 03:20:51
问题 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

How to display database records in asp.net mvc view

[亡魂溺海] 提交于 2019-11-27 10:59:11
问题 Using ASP.NET MVC with C#, how do you pass some database records to a View and display them in table form? I need to know how I can transfer/pass some rows of records from a database that have been returned to an SqlDataReader object and pass that object to the View so I can display all the records contained by the object in the View using foreach. The following code is what I'm I'm trying to do. But its not working. The Controller: public ActionResult Students() { String connectionString = "

SqlCommand() ExecuteNonQuery() truncates command text

北慕城南 提交于 2019-11-27 07:35:48
问题 I'm building a custom db deployment utility, I need to read text files containing sql scripts and execute them against the database. Pretty easy stuff, so far so good. However I've encountered a snag, the contents of the file are read successfully and entirely, but once passed into the SqlCommand and then executed with SqlCommand.ExecuteNonQuery only part of the script is executed. I fired up Profiler and confirmed that my code is not passing all of the script. private void ExecuteScript

How to use SqlClient in ASP.NET Core?

落爺英雄遲暮 提交于 2019-11-27 00:49:44
问题 I am trying to use SQLClient library in the ASP.net Core but cant seem to get it working. I found this article online advising how to setup but its not working for me: http://blog.developers.ba/using-classic-ado-net-in-asp-net-vnext/ I have a simple console application package. My project.json looks like this: { "version": "1.0.0-*", "description": "DBTest Console Application", "authors": [ "" ], "tags": [ "" ], "projectUrl": "", "licenseUrl": "", "compilationOptions": { "emitEntryPoint":