connect to database c#

后端 未结 2 1710
面向向阳花
面向向阳花 2021-01-06 18:59

I\'m trying to connect to a DB on a server using C# but with no luck.

I tried using this:

public static string m_ConnectionString =
    @\"Network Li         


        
2条回答
  •  暖寄归人
    2021-01-06 19:23

    I think that Data Source=*server ip*,*port*; should be Data Source=*server ip*:*port*;, replacing , with :. But if the port is not specific, I don't think you really need it. Also you're not defining a driver, I don't know it this works without it.

    Also a advice: look up LINQ to SQL or ADO.NET Entity Data Model. Those can really simplify use of databases and using LINQ you can write a query inside code which is a lot similar to sql and Visual Studio also helps with intellisense so you don't have to remember all table and column names.

提交回复
热议问题