Created
September 29, 2025 16:27
-
-
Save jskeet/f9cc90e8915d02d43406c3e02c6a6308 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 Microsoft.Data.SqlClient; | |
SqlCommand sqlCommand = new SqlCommand(); | |
sqlCommand.CommandText = "SELECT * FROM dbo.USERS"; | |
sqlCommand.CommandType = System.Data.CommandType.Text; | |
Console.WriteLine(sqlCommand.CommandText); |
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?
Yes, I have pasted the complete code below. I'm running .NET 2019 ...
maybe thats the problem.
using System;
using Microsoft.Data.SqlClient;
namespace ConsoleApp2
{
class Program
{
static void Main(string[] args)
{
SqlCommand sqlCommand = new SqlCommand();
sqlCommand.CommandText = "SELECT * FROM dbo.USERS";
sqlCommand.CommandType = System.Data.CommandType.Text;
Console.WriteLine(sqlCommand.CommandText);
}
}
}
…On Mon, Sep 29, 2025 at 10:43 AM Jon Skeet ***@***.***> wrote:
@jskeet commented on this gist.
________________________________
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?
—
Reply to this email directly, view it on GitHub or unsubscribe.
You are receiving this email because you commented on the thread.
Triage notifications on the go with GitHub Mobile for iOS or Android.
--
***@***.***
503-481-2380
Yeah, its a version thing. I tried it with a new install of VS on a
different machine and its working fine.
…On Mon, Sep 29, 2025 at 10:43 AM Jon Skeet ***@***.***> wrote:
@jskeet commented on this gist.
________________________________
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?
—
Reply to this email directly, view it on GitHub or unsubscribe.
You are receiving this email because you commented on the thread.
Triage notifications on the go with GitHub Mobile for iOS or Android.
--
***@***.***
503-481-2380
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
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