using system;
using system.configuration;
using system.data;
using system.data.sqlclient;
namespace cj168.dataaccess
{
public class magsdb
{
//sqlconnection myconnection = new sqlconnection(configurationsettings.appsettings["connectionstring"]);
public void openconn()
{
//myconnection.open();
}
public void closeconn()
{
//myconnection.close();
}
public sqldatareader getmagissue(int magid, int magyear)
{
sqlconnection myconnection = new sqlconnection(configurationsettings.appsettings["connectionstring"]);
sqlcommand mycommand = new sqlcommand("getmagissue", myconnection);
mycommand.commandtype = commandtype.storedprocedure;
sqlparameter parametermagid = new sqlparameter("@magid", sqldbtype.int, 4);
parametermagid.value = magid;
mycommand.parameters.add(parametermagid);
sqlparameter parametermagyear = new sqlparameter("@magyear", sqldbtype.int, 4);
parametermagyear.value = magyear;
mycommand.parameters.add(parametermagyear);
myconnection.open();
sqldatareader result = mycommand.executereader(commandbehavior.closeconnection);
//sqldatareader result = mycommand.executereader();
return result;
}
public dataset getmagissuecat(int magid, int magyear, int yearissue)
{
sqlconnection myconnection = new sqlconnection(configurationsettings.appsettings["connectionstring"]);
sqldataadapter mycommand = new sqldataadapter("getmagissuecat", myconnection);
mycommand.selectcommand.commandtype = commandtype.storedprocedure;
sqlparameter parametermagid = new sqlparameter("@magid", sqldbtype.int, 4);
parametermagid.value = magid;
mycommand.selectcommand.parameters.add(parametermagid);
sqlparameter parametermagyear = new sqlparameter("@magyear", sqldbtype.int, 4);
parametermagyear.value = magyear;
mycommand.selectcommand.parameters.add(parametermagyear);
sqlparameter parameteryearissue = new sqlparameter("@yearissue", sqldbtype.int, 4);
parameteryearissue.value = yearissue;
mycommand.selectcommand.parameters.add(parameteryearissue);
dataset mydataset = new dataset();
//myconnection.open();
mycommand.fill(mydataset);
//sqldatareader result = mycommand.executereader(commandbehavior.closeconnection);
//sqldatareader result = mycommand.executereader();
//return result;
return mydataset;
}
public dataset getsubcat(int magid, int magyear, int yearissue, int catid)
{
sqlconnection myconnection = new sqlconnection(configurationsettings.appsettings["connectionstring"]);
sqldataadapter mycommand = new sqldataadapter("getsubcat", myconnection);
mycommand.selectcommand.commandtype = commandtype.storedprocedure;
sqlparameter parametermagid = new sqlparameter("@magid", sqldbtype.int, 4);
parametermagid.value = magid;
mycommand.selectcommand.parameters.add(parametermagid);
sqlparameter parametermagyear = new sqlparameter("@magyear", sqldbtype.int, 4);
parametermagyear.value = magyear;
mycommand.selectcommand.parameters.add(parametermagyear);
sqlparameter parameteryearissue = new sqlparameter("@yearissue", sqldbtype.int, 4);
parameteryearissue.value = yearissue;
mycommand.selectcommand.parameters.add(parameteryearissue);
sqlparameter parametercatid = new sqlparameter("@catid", sqldbtype.int, 4);
parametercatid.value = catid;
mycommand.selectcommand.parameters.add(parametercatid);
dataset mydataset = new dataset();
//myconnection.open();
//sqldatareader result = mycommand.executereader(commandbehavior.closeconnection);
//sqldatareader result = mycommand.executereader();
//return result;
mycommand.fill(mydataset);
return mydataset;
}
public dataset getmagarttitle(int catissueid)
{
sqlconnection myconnection = new sqlconnection(configurationsettings.appsettings["connectionstring"]);
sqldataadapter mycommand = new sqldataadapter("getmagarttitle", myconnection);
mycommand.selectcommand.commandtype = commandtype.storedprocedure;
sqlparameter parametercatissueid = new sqlparameter("@catissueid", sqldbtype.int, 4);
parametercatissueid.value = catissueid;
mycommand.selectcommand.parameters.add(parametercatissueid);
//myconnection.open();
//sqldatareader result = mycommand.executereader(commandbehavior.closeconnection);
//sqldatareader result = mycommand.executereader();
//return result;
dataset mydataset = new dataset();
mycommand.fill(mydataset);
return mydataset;
}
public dataset getartdetail(int txtid)
{
sqlconnection myconnection = new sqlconnection(configurationsettings.appsettings["connectionstring"]);
sqldataadapter mycommand = new sqldataadapter("getartdetail", myconnection);
mycommand.selectcommand.commandtype = commandtype.storedprocedure;
sqlparameter parametertxtid = new sqlparameter("@txtid", sqldbtype.int, 4);
parametertxtid.value = txtid;
mycommand.selectcommand.parameters.add(parametertxtid);
//myconnection.open();
//sqldatareader result = mycommand.executereader(commandbehavior.closeconnection);
//sqldatareader result = mycommand.executereader();
//return result;
dataset mydataset = new dataset();
mycommand.fill(mydataset,"artdetail");
return mydataset;
}
}
/*
public sqldatareader getmagissue(int magid, int magyear, sqlconnection myconnection)
{
//sqlconnection myconnection = new sqlconnection(configurationsettings.appsettings["connectionstring"]);
//myconnection.open();
sqlcommand mycommand = new sqlcommand("getmagissue", myconnection);
mycommand.commandtype = commandtype.storedprocedure;
sqlparameter parametermagid = new sqlparameter("@magid", sqldbtype.int, 4);
parametermagid.value = magid;
mycommand.parameters.add(parametermagid);
sqlparameter parametermagyear = new sqlparameter("@magyear", sqldbtype.int, 4);
parametermagyear.value = magyear;
mycommand.parameters.add(parametermagyear);
//myconnection.open();
sqldatareader result = mycommand.executereader(commandbehavior.closeconnection);
//sqldatareader result = mycommand.executereader();
return result;
}
public sqldatareader getmagissuecat(int magid, int magyear, int yearissue, sqlconnection myconnection)
{
//sqlconnection myconnection = new sqlconnection(configurationsettings.appsettings["connectionstring"]);
sqlcommand mycommand = new sqlcommand("getmagissuecat", myconnection);
mycommand.commandtype = commandtype.storedprocedure;
sqlparameter parametermagid = new sqlparameter("@magid", sqldbtype.int, 4);
parametermagid.value = magid;
mycommand.parameters.add(parametermagid);
sqlparameter parametermagyear = new sqlparameter("@magyear", sqldbtype.int, 4);
parametermagyear.value = magyear;
mycommand.parameters.add(parametermagyear);
sqlparameter parameteryearissue = new sqlparameter("@yearissue", sqldbtype.int, 4);
parameteryearissue.value = yearissue;
mycommand.parameters.add(parameteryearissue);
//myconnection.open();
sqldatareader result = mycommand.executereader(commandbehavior.closeconnection);
//sqldatareader result = mycommand.executereader();
return result;
}
public sqldatareader getsubcat(int magid, int magyear, int yearissue, int catid, sqlconnection myconnection)
{
//sqlconnection myconnection = new sqlconnection(configurationsettings.appsettings["connectionstring"]);
sqlcommand mycommand = new sqlcommand("getsubcat", myconnection);
mycommand.commandtype = commandtype.storedprocedure;
sqlparameter parametermagid = new sqlparameter("@magid", sqldbtype.int, 4);
parametermagid.value = magid;
mycommand.parameters.add(parametermagid);
sqlparameter parametermagyear = new sqlparameter("@magyear", sqldbtype.int, 4);
parametermagyear.value = magyear;
mycommand.parameters.add(parametermagyear);
sqlparameter parameteryearissue = new sqlparameter("@yearissue", sqldbtype.int, 4);
parameteryearissue.value = yearissue;
mycommand.parameters.add(parameteryearissue);
sqlparameter parametercatid = new sqlparameter("@catid", sqldbtype.int, 4);
parametercatid.value = catid;
mycommand.parameters.add(parametercatid);
//myconnection.open();
sqldatareader result = mycommand.executereader(commandbehavior.closeconnection);
//sqldatareader result = mycommand.executereader();
return result;
}
public sqldatareader getmagarttitle(int catissueid, sqlconnection myconnection)
{
//sqlconnection myconnection = new sqlconnection(configurationsettings.appsettings["connectionstring"]);
sqlcommand mycommand = new sqlcommand("getmagarttitle", myconnection);
mycommand.commandtype = commandtype.storedprocedure;
sqlparameter parametercatissueid = new sqlparameter("@catissueid", sqldbtype.int, 4);
parametercatissueid.value = catissueid;
mycommand.parameters.add(parametercatissueid);
//myconnection.open();
sqldatareader result = mycommand.executereader(commandbehavior.closeconnection);
//sqldatareader result = mycommand.executereader();
return result;
}
}
*/
/// <summary>
/// summary description for webcustomcontrol1.
/// </summary>
}