当前位置:Gxlcms > 数据库问题 > 系统标准SQL连接 Class

系统标准SQL连接 Class

时间:2021-07-01 10:21:17 帮助过:8人阅读

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

标签:new   void   class   ase   inf   user   ndt   null   init   

人气教程排行