Skip to content

Instantly share code, notes, and snippets.

@jskeet
Created September 29, 2025 16:27
Show Gist options
  • Save jskeet/f9cc90e8915d02d43406c3e02c6a6308 to your computer and use it in GitHub Desktop.
Save jskeet/f9cc90e8915d02d43406c3e02c6a6308 to your computer and use it in GitHub Desktop.
using Microsoft.Data.SqlClient;
SqlCommand sqlCommand = new SqlCommand();
sqlCommand.CommandText = "SELECT * FROM dbo.USERS";
sqlCommand.CommandType = System.Data.CommandType.Text;
Console.WriteLine(sqlCommand.CommandText);
@pattenscott
Copy link

I tried your code and received the same error. I'm wondering if it's the microsoft.data.sqlclient? I've got version 6.1.1

@jskeet
Copy link
Author

jskeet commented Sep 29, 2025

That exact code, and no other code, in a fresh console app? Yes, that's what I've got as well, targeting .NET 9. What version of .NET are you targeting?

@pattenscott
Copy link

pattenscott commented Sep 29, 2025 via email

@pattenscott
Copy link

pattenscott commented Sep 29, 2025 via email

@jskeet
Copy link
Author

jskeet commented Sep 29, 2025

Okay, good to know about using .NET 2019. Can you post the project file as well? (Hopefully an SDK-style one?) That way there should be enough to reproduce the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment