首先申明,本人编程菜鸟,本文只是自己的一个总结,各位看客莫笑! 今天闲来无事,写了一段C#.NET 连接 SQLServer 的代码, 写的过程中查找了一些资料,并遇到了一些问题, 闲话少说,先上代码。 using System; using System.Collections.Generic; using System.Text; using System.Data; using System.Data.SqlClient; namespace Test { public class DBConnection { public static void getDBData(out List<string[]> rsltList) { rsltList = new List<string[]>(); SqlConnection objConnection = null; try { string strConnection = "Persist Security Info=False;user id=myID;password=myPWD;initial catalog=northwind;Server=mySQLServer;Connect Timeout=30"; // myID就是用户名 // myPWD就是密码 // northwin