首页 > 数据库技术 > 详细

系统标准SQL连接 Class

时间:2019-06-10 12:55:02      阅读:112      评论:0      收藏:0      [点我收藏+]
class WL_SystemStdConnectionSql
{
    System.Data.SqlClient.SqlConnection     cnn;
    System.Data.SqlClient.SqlCommand        command;
    System.Data.SqlClient.SqlDataReader     reader;
}
void close()
{
    ;
    cnn.Close();
    cnn = null;
void ExecuteNonQuery(str    strsql)
{
    ;
    if (!strsql)
        throw error("SQL语句不存在");
    command.set_CommandText(strsql);
    command.ExecuteNonQuery();
}
void ExecuteReader(str    strsql)
{
    ;
    if (!strsql)
        throw error("SQL语句不存在");
    command.set_CommandText(strsql);
    reader = command.ExecuteReader();
void open(str           _serverId = sysSqlSystemInfo::construct().getLoginServer(), 
               str           _dataId   = sysSqlSystemInfo::construct().getloginDatabase(),
               str           _userId   = "xxxx",
               str           _pwd      = "********")
{
    str     connectionStr;
    ;
    connectionStr = "Data Source="+ _serverId + "; Initial Catalog=" + _dataId +";" +
                    " Persist Security Info = True;User ID=" + _userId +"; Password=" + _pwd;
    cnn = new System.Data.SqlClient.SqlConnection(connectionStr);
    cnn.Open();
    command = cnn.CreateCommand();
    command.set_CommandTimeout(3600);
}
public System.Data.SqlClient.SqlCommand parmCommand(System.Data.SqlClient.SqlCommand _command = command)
{
    ;
    command = _command;
    return command;
}
public System.Data.SqlClient.SqlDataReader parmReader(System.Data.SqlClient.SqlDataReader _reader = reader)
{
    ;
    reader = _reader;
    return reader;
}

 

 

系统标准SQL连接 Class

原文:https://www.cnblogs.com/xtwkh1973/p/10997029.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!