系统标准SQL连接 Class

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;
}

 

 

posted @ 2019-06-10 12:18  学习是进步的阶梯  阅读(294)  评论(0)    收藏  举报