请问vs2008与sql server2000的连接具体步骤和代码?最好有完整测试代码。
1个回答
2012-01-19
展开全部
1、在桌面建立一个udl文件,填写相关信息,获得连接字符串
2、using System.Data;
using System.Data.SqlClient;
..
string strConnection="user id=sa;password=;";
strConnection+="initial catalog=Northwind;Server=YourSQLServer;";//这里复制连接字符串,要添加sa密码
strConnection+="Connect Timeout=30";
SqlConnection objConnection=new SqlConnection(strConnection);
..
objConnection.Open();
objConnection.Close();
2、using System.Data;
using System.Data.SqlClient;
..
string strConnection="user id=sa;password=;";
strConnection+="initial catalog=Northwind;Server=YourSQLServer;";//这里复制连接字符串,要添加sa密码
strConnection+="Connect Timeout=30";
SqlConnection objConnection=new SqlConnection(strConnection);
..
objConnection.Open();
objConnection.Close();
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询