C# 连接 SQL Server

    技术2022-05-11  52

     通过Windows身份验证来连接:

    sqlconnection new sqlconnection.connectionstring = "Persist  Security  Info=False;Integrated  Security=SSPI;database=northwind;server=mySQLServer"

    通过SQL 中的 SA 用户验证来连接:

    sqlconnection new sqlconnection.connectionstring="Persist  Security  Info=False;UId=sa;Pwd=xxx;database=northwind;server=mySQLServer"  

    通过 OLEDB 来连接:

    oledbconnection.connectionstring = "Provider=SQLOLEDB;Data  Source=localhost;Initial  Catalog=Northwind;User   id=sa;password=xxx"


    最新回复(0)