Picture upload part of the database (automatically generate the sketch)
Source: Internet
Author: User
Upload | data | database public int Fepicdataset (string strpictitle, String strpicdate, string strpicname, int intpictype, string str Picintro, 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);
Execute the command in a try/catch to catch duplicate username errors
Try
{
The 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 ();
}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.