public int fepicdataset(string strpictitle, string strpicdate, string strpicname, int intpictype, string strpicintro, string strthumbnail, int opid)
{
//string strpictitle,
//string strpicdate,
//string strpicname,
//int intpictype,
//string strpicintro,
//string strpicname,
//string strthumbnail,
//int opid
sqlconnection myconnection = new sqlconnection(configurationsettings.appsettings["connectionstring"]);
sqlcommand mycommand = new sqlcommand("mag_fepicdataset", myconnection);
// mark the command as a sproc
mycommand.commandtype = commandtype.storedprocedure;
// add parameters to sproc
sqlparameter parameteruserid = new sqlparameter("@opid", sqldbtype.int);
parameteruserid.value = opid;
mycommand.parameters.add(parameteruserid);
sqlparameter parameterpictitle = new sqlparameter("@pictitle", sqldbtype.char, 30);
parameterpictitle.value = strpictitle;
mycommand.parameters.add(parameterpictitle);
sqlparameter parameterpicdate = new sqlparameter("@picdate", sqldbtype.char, 10);
parameterpicdate.value = strpicdate;
mycommand.parameters.add(parameterpicdate);
sqlparameter parameterpicname = new sqlparameter("@picname", sqldbtype.char, 50);
parameterpicname.value = strpicname;
mycommand.parameters.add(parameterpicname);
sqlparameter parameterpictype = new sqlparameter("@pictype", sqldbtype.int);
parameterpictype.value = intpictype;
mycommand.parameters.add(parameterpictype);
sqlparameter parameterpicintro = new sqlparameter("@picintro", sqldbtype.char, 255);
parameterpicintro.value = strpicintro;
mycommand.parameters.add(parameterpicintro);
sqlparameter parameterthumbnail = new sqlparameter("@thumbnail", sqldbtype.char, 50);
parameterthumbnail.value = strthumbnail;
mycommand.parameters.add(parameterthumbnail);
sqlparameter parameterhostaddress = new sqlparameter("@opip", sqldbtype.char, 15);
parameterhostaddress.value = context.request.userhostaddress;
mycommand.parameters.add(parameterhostaddress);
//sqlparameter parameterrid = new sqlparameter("@returnid", sqldbtype.int);
//parameterreturnuserid.value = -1;
//parameterrid.direction = parameterdirection.output;
//mycommand.parameters.add(parameterrid);
// execute the command in a try/catch to catch duplicate username errors
try
{
// open the connection and execute the command
myconnection.open();
mycommand.executenonquery();
}
catch
{
// failed to create a new user
return -1;
}
finally
{
// close the connection
if (myconnection.state == connectionstate.open)
myconnection.close();
}
return 1;
}