C
C#16mo ago
LycRicks

dotnet 8

How can I use MS SQL and Entity Framework in a console application in Dotnet 8? Can someone give an example?
24 Replies
Jimmacle
Jimmacle16mo ago
have you looked at the MS documentation? there are lots of examples there
LycRicks
LycRicksOP16mo ago
can you throw it
LycRicks
LycRicksOP16mo ago
thx I found how to do it, but I am not using local data. What kind of connection string should I use to connect to data on a server?
Jimmacle
Jimmacle16mo ago
it depends on your server
LycRicks
LycRicksOP16mo ago
I don't understand
Jimmacle
Jimmacle16mo ago
do you have a SQL server?
LycRicks
LycRicksOP16mo ago
yes
Jimmacle
Jimmacle16mo ago
and how do you authenticate with it?
LycRicks
LycRicksOP16mo ago
I don't know how to do it, in the examples it always uses local data.
Jimmacle
Jimmacle16mo ago
i'm not talking about the examples i'm asking you how you access your sql server right now
LycRicks
LycRicksOP16mo ago
1 min
Jimmacle
Jimmacle16mo ago
my point is, you're going to use the same server address and username/password in your connection string
LycRicks
LycRicksOP16mo ago
I can connect from here But I don't know how to write it as string
Jimmacle
Jimmacle16mo ago
have you looked up any examples?
LycRicks
LycRicksOP16mo ago
I tried this but it didn't work
Jimmacle
Jimmacle16mo ago
you just leaked your SA password you should delete that image
LycRicks
LycRicksOP16mo ago
In the examples I looked at, they always use local data.
Jimmacle
Jimmacle16mo ago
like seriously delete it immediately
LycRicks
LycRicksOP16mo ago
No problem, I can change
Jimmacle
Jimmacle16mo ago
so when i google "ms sql server connection string" the first result shows me an example just like what you need did you try that?
LycRicks
LycRicksOP16mo ago
server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;
Jimmacle
Jimmacle16mo ago
yes
LycRicks
LycRicksOP16mo ago
Are you talking about this? okeyy thx I'm trying How can I solve this? Trusted_Connection=True; I think I found it no, that's not it yes I found

Did you find this page helpful?