开发者

I can't make a connection to SQL Server with my local IP in C#

开发者 https://www.devze.com 2023-04-03 17:35 出处:网络
I have one problem with C# I connect Data Source=BARIS;Initial Catalog=SurucuOtomasyon;User ID=sa;Password=1234

I have one problem with C#

I connect Data Source=BARIS;Initial Catalog=SurucuOtomasyon;User ID=sa;Password=1234

But I don't connect database when i write mylocal ip to Data Source

Data Source=192.168.1.3;Initia开发者_StackOverflowl Catalog=SurucuOtomasyon;User ID=sa;Password=1234

Thanks for helping


an answer

Open your SQL Configuration Manager and allow to TCP/IP connections. Set dynamic port blank to disable it (i don't remember here well) The IP gives the machine, you need a port, too:

192.168.1.3:1433 (the port 1433 is a standart)

another link about connectionstrings

connection string with DataSource=192.168.2.3 is enough. You have to change configurationn. Right configuration will run your code. (i've tested it with a project, its all about configuration of your sql. See my comment below)

0

精彩评论

暂无评论...
验证码 换一张
取 消