Questions tagged [sqlclient]

Microsoft ADO.NET System.Data.SqlClient, contained in System.Data.dll, used for connecting to SQL Server from .NET applications.

0
votes
0answers
5 views

Strange behavour with SqlParameter

Using .Net 4.5.2 I have the following example code... var cmd = new SqlCommand(); cmd.Parameters.Add(new SqlParameter("@CONTENTHYPERLINK", SqlDbType.VarChar, 50)); cmd.Parameters["@contentHyperlink"]....
0
votes
0answers
46 views

Connection to SQL Server fails on Surface but not anywhere else

I've been working on my UWP app on my development machine and everything worked fine so far. So I wanted to test it on an actual tablet using a Surface. As soon as I deploy it via Remote Debugging it ...
1
vote
1answer
55 views

How to use Generic with SqlDataReader

I'm trying to come up with a way just to load a table from SQL Server into a class, without having to tell it anything. Basically, just create the class and have it know what to load, based on that. ...
1
vote
1answer
45 views

SQL Server CE vs SqlClient

What is the difference between SqlServerCe and SqlClient code? Does EF code first require SqlServerCe, or is it capable of SqlClient also? What provider should I choose if I am operating on a local ...
0
votes
0answers
24 views

sql queries inside for loop using SQLCLient

I am trying to execute the following piece of code, to add the result obtained from db to list, `env.getCapabilities().forEach(action->{ con.queryWithParams("select @rid from ...
0
votes
0answers
70 views

Could not load file or assembly error in Visual Studio

When I'm trying to launch this program: public MainPage() { this.InitializeComponent(); string connectionString = null; SqlConnection db; connectionString = @"...
0
votes
0answers
52 views

Why is my connection string failing?

Does anybody have any reason this would fail on a local DB? connectionString="Data Source=localhost\MSSQLEXPRESS;Initial Catalog=K2Consulting;User Id=domain\myUser;Password=Password;Pooling=false;...
-1
votes
1answer
74 views

Get data from SQL Server C#

I'm newbie in C# I have 2 methods In the first method, I want to get the result of the execution sql query - this number (for example 123456) and insert the number (123456) into the text field (second ...
2
votes
1answer
30 views

SqlClient.ExecuteNonQuery not returning number of rows

I have been dealing with this for a while now. I have a simple PowerShell function that takes an open connection to an SQL Server and a String containing an SQL command and runs it against the server. ...
0
votes
1answer
101 views

SQL Server handshake timeout error at the pre-login

I'm running VS 2015 and SQL Server 2008 R2 on a remote server. When I try to connect to my database via SSMS, everything is fine. When I try to connect via Visual Studio Server Explorer, it also ...
0
votes
0answers
19 views

SSL end to end Security in SQL Server and c# SqlClient traffic

I have enabled Encryption in SQL Connection string and also configured force encryption in SQL Server configuration Manager tool using self signed certificate. However security tester was able to ...
-1
votes
3answers
43 views

Getting always FALSE as a result of Table Exists method using C# SQLClient MSSQL

I have the code like this for checking if database exists: private bool CheckDatabase(string databaseName) { var connString = "Server=localhost\\SQLEXPRESS;Integrated Security = SSPI; ...
3
votes
1answer
255 views

TDS Error on Azure Entity Framework SQL Calls after Windows 10 April 2018 Update [duplicate]

I have the following C# code that executes against a SQL Server hosted in Azure. protected IQueryable<T> FilterUpdatedRows<T>(IQueryable<T> query, DateTime lastSyncTimestamp) where ...
8
votes
5answers
727 views

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

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 ...
1
vote
1answer
66 views

Output parameter returns zero while stored procedure returns affected rows count

I am doing a user registration page. Inserting user stored procedure is working perfectly and in SQL Server and Profile viewer, output parameter returns @@Rowcount, while calling this stored procedure ...
0
votes
0answers
31 views

Connent to phpMyadim through SQL CLIENT APP

Hello guys i created an sql data base in phpMyAdmin and i try to connect to via an app called SQL CLIENT it connects but when i try to see the tables of the database its loading forever Thanks!
1
vote
2answers
53 views

My SqlDataReader Has No Rows?

When I'am debugging my console says that my reader has no rows. Below you can find the code. public ActionResult Login(LoginViewModel loginViewModel) { bool isSucces = false; if (...
-1
votes
1answer
54 views

How to perform soft delete and undelete in SQL client(C# windows form app)

I am trying to soft delete a row in the table. Once I update it, if I want to undelete my row, I should be able to do it. Also, I like to purge delete, permanent delete. I am using SQL client using C# ...
1
vote
1answer
40 views

How can I get inserted ID in SQL Server while using SqlClient class?

So this is a continuation of post: Best way to get identity of inserted row? That post proposes, and I agree, to use Inserted feature to safely return inserted id column(s). While implementing this ...
0
votes
2answers
51 views

SQLClient Command Parameter Query String Length

I am connecting to a SQL Server and am trying to limit the results by adding parameters. The first parameter I added, @sdate, worked just fine. But, now I am trying to add a second parameter which ...
1
vote
0answers
148 views

System.OutOfMemoryException when reading an XML file to write to SQL Database

Currently, I am reading from a XML file (my program previously creates in the File System) and writing the contents of that XML file into the database using the SQLXml Object. We only encounter this ...
1
vote
1answer
2k views

Unable to locate System.Data.SqlClient reference

I have a fresh Visual Studio 2017 Professional install. I'm building a quick POC Console application using .NET 4.7.1, and I'm unable to find the reference for System.Data.SqlClient. I have scoured ...
0
votes
1answer
41 views

Connect to database in sepaerate method of my SqlCommand

I have a form that checks whether values are in a database before adding them. Each field is in a different table, and to keep everything clean, I have a checkExists method for each field. Is there a ...
0
votes
1answer
245 views

db2 database gui interface

Which database client tool (gui tool), can be used to view/modify the user permissions in a db2 database. The version is db2 v 11.1. control center is discontinued as per the notes in publib. ...
0
votes
1answer
161 views

Find matching contacts from contact list in an SQL table

I'm currently writing a server application for a chat app which receives the phone contact list from an users adressbook as a List<string> where the string is a standardized phone number. I now ...
-1
votes
1answer
202 views

I am getting an error 26 connection issue to SQL server

I created a datasource using the wizard, previewed the data, and everything looks good, all of the data is showing up. I attempt to use the fill method on the built in datagrid control, and it times ...
-3
votes
3answers
107 views

Connect and insert from C# with database located on server

insertion from php code works properly with same database name, user, password and localhost name as it is. I'm trying to connect and insert records from winform desktop application fields to ...
0
votes
1answer
615 views

How to correctly setup the connection string to availability group for legacy app

Imagine you have the following scenario: A .net framework 2.0 legacy client app. An SQL Server 2016 Always On Availability Group. How the connection string should be? I can think on two options: ...
0
votes
0answers
51 views

Xamarin Database Connection Refuse

I'm trying to get connected to my own MySQL Database over the System.Data.SqlClient but every time i'm trying i'll get in the Timeout because of the server is unreachable. I also tried the MySQL ...
0
votes
1answer
147 views

Xamarin System.Data.Sqlclient Issue

I am new to Xamarin. I just started a test project and I want to establish SQL Server connection using VS2017 and last version of Xamarin with .net core shared project. I can download and install ...
4
votes
0answers
338 views

How to write a DB-agnostic .NET Core app?

I'm struggling to port a console app from .NET Framework 4.6.2 to .NET Core 2.0. The app needs to connect to a database whose platform is not known at compile time. In the full framework this was ...
1
vote
1answer
149 views

Transaction becomes null after SqlCommand.ExecuteScalar is run

I have a table in SQL Server defined as follows create table Customer (ID varchar(10), Name varchar(200)) Insert into Customer values ('00001', 'Cust1'), ('ID00002', 'Cust2') When I query customer ...
0
votes
0answers
28 views

ExecuteScalar value not transitting back to .NET code

We have some code that builds a SQL statement and then executes it via ExecuteScalar. Here is the pertinent SQL code... It inserts into the RECEIPTS table, selects out the inserted identity value into ...
0
votes
0answers
26 views

Switching OleDB to SQLClient yields Incorrect syntax near '?' error

All, I have an old .Net web application and I am trying to replace the provider from "System.Data.OleDb" to "System.Data.SqlClient" as SQL 2016 no longer supports OLEDb. However I get the following ...
1
vote
1answer
92 views

How to extract data from DB with correct encoding using PowerShell's SqlClient.SqlConnection?

I have the following working code: Function DumpAssets { Param( [string]$DestinationPath = 'X:\path\to\dump_folder' ) $SQLServer = "SQLSERVER123" $SQLDBName = "SUPER_DB" ...
0
votes
0answers
29 views

Updates to SQL Azure reverting when closing browser or waiting 1 minute

I have a tricky issue with an update query in SQL Azure. I have tried using an EntityFramework update, to include attaching to the entity, setting it to Modified state, and calling SaveChanges on the ...
0
votes
1answer
121 views

Can't create migration in asp.net core 2.0

I am trying to create Identity migration is ASP.NET Core 2.0 and getting error. System.Data.SqlClient.SqlException (0x80131904): Cannot open database "MarketIdentity" requested by the login. The ...
2
votes
0answers
91 views

Weird occasional exception connecting to SQL server - “something that is not a socket”

I have two Windows servers in production, one runs SQL Server server database, another is a web-server running an ASP.NET app in IIS. Heavy traffic between the two. Occasionally I get this random ...
0
votes
1answer
418 views

how to run init sql after I create a new postgre instance in terraform

I am fine to create a new rds (postgre) instance with terraform. But I need to run a sql (init.sql) after the instance is ready. This sql need be run once only, what should I do? I tried local-...
0
votes
1answer
56 views

.NET access to SQL over network is faster than locally - um, why?

I have an unusual issue in that one of my servers is performing better than all the others and I want to know why - this is so I can make the others work as well :-) Here is my (simplified) scenario: ...
0
votes
3answers
22 views

How to get auto incremented id at the same time when inserted data in sqlClient?

I am using stored procedure to insert data. I have 2 tables one to store the customer details and the other one is used to store the payment history. So when I press insert details button on my form ...
1
vote
0answers
285 views

SqlConnection failing on open when using .Net Core and targeting 4.6.1

I have an application made in ASP.NET Core, which I wanted to revert to ASP.NET 4.6.1 so I would be able to use Entity Framework with lazy loading. I followed this tutorial here which seemed to work ...
-2
votes
3answers
49 views

Getting tables name in Console application

I'm trying getting tables name in database, the connection is successful but the select Query give me (System.Data.SqlClient.SqlCommand) in the result. below my code. SqlCommand cmd = new SqlCommand("...
-7
votes
1answer
49 views

c# how to update data with photo looking for some help to understand :'( [closed]

Hi guys how can i update my data with photo without error my database name is table and the table content is id, FirstName, MiddleName, LastName, Gender, Address, DateofBirth, PlaceofBirth, ...
8
votes
3answers
3k views

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

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 ...
0
votes
1answer
30 views

SQL Server installation error SQLCLI component

I am trying to install SQL Server 2016 but getting error on installing SQL Server Native Client, I have tried installing SQL Server 2012, 2014, 2016 and 2017 RC well but all are failing on installing ...
0
votes
1answer
29 views

What format does System.Data.SqlClient use to transmit procedure parameters to SQL Server

Trying to estimate the amount of data transmitted over a network to SQL server when using System.Data.SqlClient to execute procedures with SqlDbType.Structured parameters. Assuming a non-encrypted ...
3
votes
0answers
562 views

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

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 ...
0
votes
1answer
36 views

SQL Select statement — more than 1 table and specific rows in select statement

I would like to know what is the right way to select more than 1 table in database in SELECT statement? Currently I'm trying with this code which executes both, but the first SELECT statemnts gets ...
-2
votes
1answer
26 views

I need help on ADO.net

Which one is appropriate? Methot 1 Dim Connection As New SqlConnection Dim CMD As New SqlCommand Connection = New SqlConnection(My.Settings.ConnectionString) CMD = Connection.CreateCommand() CMD....