Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/31.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/EmptyTag/141.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 删除PhotoUploader.cs_C#_Asp.net - Fatal编程技术网

C# 删除PhotoUploader.cs

C# 删除PhotoUploader.cs,c#,asp.net,C#,Asp.net,请帮助我,我想删除此代码中的PhotoUploader.cs: protected void RadButton39_Click(object sender, EventArgs e) { try { HttpFileCollection uploadedFiles = Request.Files; PhotoUploader uploader = new PhotoUploader(); for (int i = 0; i &

请帮助我,我想删除此代码中的PhotoUploader.cs:

protected void RadButton39_Click(object sender, EventArgs e)
{

    try
    {

        HttpFileCollection uploadedFiles = Request.Files;
        PhotoUploader uploader = new PhotoUploader();
        for (int i = 0; i < uploadedFiles.Count; i++)
        {
            HttpPostedFile userPostedFile = uploadedFiles[i];
            if (userPostedFile.ContentLength > 0)
            {
                using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
                {
                    uploader.StartUploadProcess(userPostedFile, 210,  "~/Img/News/");
                    string small_pic_name = uploader.LastImageName;

                    uploader.StartUploadProcess(userPostedFile, 650, "~/Img/News/");
                    string big_pic_name = uploader.LastImageName;

                    string commandText = "INSERT INTO NewsGallery(ID,   Small_pic, Big_pic) VALUES ('" + int.Parse(GridView1.SelectedDataKey.Value.ToString()) + "','" + small_pic_name + "', '" + big_pic_name + "')";
                    SqlCommand command = new SqlCommand(commandText, connection);

                    connection.Open();
                    int rowsAffected = command.ExecuteNonQuery();
                    if (rowsAffected == 1)
                    {
                        // MessageLabel.Text = "";
                    }
                    connection.Close();
                }
            }
            GridView1.DataBind();
            GridView2.DataBind();
        }
    }
    catch { }
}
protectedvoid RadButton39\u单击(对象发送方,事件参数e)
{
尝试
{
HttpFileCollection uploadedFiles=Request.Files;
PhotoUploader uploader=新的PhotoUploader();
对于(int i=0;i0)
{
使用(SqlConnection连接=新的SqlConnection(ConfigurationManager.ConnectionString[“ConnectionString”].ConnectionString))
{
uploader.StartUploadProcess(userPostedFile,210,“~/Img/News/”;
字符串small\u pic\u name=uploader.LastImageName;
uploader.StartUploadProcess(userPostedFile,650,“~/Img/News/”;
字符串big\u pic\u name=uploader.LastImageName;
string commandText=“插入到新闻库(ID、小图片、大图片)值(“+int.Parse(GridView1.SelectedDataKey.Value.ToString())+”、“+Small图片名称+”、“+Big图片名称+”);
SqlCommand=newsqlcommand(commandText,connection);
connection.Open();
int rowsAffected=command.ExecuteNonQuery();
如果(rowsAffected==1)
{
//MessageLabel.Text=“”;
}
connection.Close();
}
}
GridView1.DataBind();
GridView2.DataBind();
}
}
捕获{}
}
我想返回到asp.net中的正常上载程序
如何实现这一点?

在这里,
PhotoUploader
类有一些专有方法(例如,
StartUplaodProcess
)正在代码中使用。首先,我们需要知道这些函数在做什么。然后,只有它将是可能的,以取代整个代码与正常的ASP上传控制。你是使用无线电控制从Telerik用户界面?