日期:2014-05-17 浏览次数:20775 次
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Data.OleDb;
namespace tests.DBOperation
{
class DBOperate
{
//根据数据库配置文件确定当前的连接字符串
public static String GetstrConn()
{
//// ClsDataContact.readDBInfo();
//String strSource;
////获取登陆模式
//int intPattern = ClsOverallVar.GetPattern();
////获取服务器名称
//String strServerName = ClsOverallVar.GetServerName();
////获取登陆账号
//String strServerId = ClsOverallVar.GetServerId();
////获取服务器名称
//String strServerPwd = ClsOverallVar.GetServerPwd();
////获取数据库名称
//String strDBName = ClsOverallVar.GetDBName();
//if (intPattern == 0) //此时为仅Windows登陆模式
// strSource = "Server=localhost;integrated security=SSPI;Initial Catalog=FixedAssetsMs";
//else //此时为混合登陆模式
// strSource = "Server=" + strServerName + ";User ID=" + strServerId + "; Password=" + strServerPwd + ";integrated security=SSPI;Initial Catalog=FixedAssetsMs";
String strSource = "database=" + ClsOverallVar.GetDBName() + ";Server=" + ClsOverallVar.GetServerName() + ";uid=" + ClsOverallVar.GetServerId() + "; pwd=" + ClsOverallVar.GetServerPwd() + ";";
return strSource;