附录2
部分程序代码
添加影片
private void Button1_Click(object sender, System.EventArgs e)
{
string fullname=this.File1.PostedFile.FileName;
string image=fullname.Substring(fullname.LastIndexOf);
string type=fullname.Substring(fullname.LastIndexOf(".")+1);
string vodname=this.File2.PostedFile.FileName;
string filename=vodname.Substring(vodname.LastIndexOf);
string filetype=vodname.Substring(vodname.LastIndexOf(".")+1);
if(filetype=="wmv"||filetype=="avi"||filetype=="asf")
{
if(type=="bmp"||type=="jpg"||type=="gif")
{
SqlConnection con=db.createcon();
con.Open();
string dl=this.DropDownList1.SelectedItem.Text;
string name=this.TextBox1.Text;
string sizve=this.TextBox2.Text;
string descr=this.TextBox3.Text;
string mainp=this.TextBox5.Text;
string time=Convert.ToString(System.DateTime.Now);
string str="insert into mess(class1,name,filename,image,sizev,descr,主要演员,times) values('"+dl+"','"+name+"','"+filename+"','"+image+"','"+sizve+"','"+descr+"','"+mainp+"','"+time+"')";
this.File1.PostedFile.SaveAs(Server.MapPath("upimage); this.File2.PostedFile.SaveAs(Server.MapPath("view);
SqlCommand cmm=new SqlCommand(str,con);
cmm.ExecuteNonQuery();
con.Close();
Response.Write("<script language=javascript>alert('添加成功')</script>"); }
else
Response.Write("<script language=javascript>alert('您存的图片格式不正确!')</script>"); }
else
{
Response.Write("<script language=javascript>alert('影片文件格式不正确!')</script>");
}
}
删除影片
private void delall()
{
CheckBox cbb=new CheckBox();
string ss=null;
int k=0;
int i,j=this.DataGrid1.Items.Count;
for(i=0;i<j;i++)
{
cbb = (CheckBox)DataGrid1.Items[i].Cells[0].FindControl("checkbox1");
if(cbb.Checked)
{
string s=this.DataGrid1.Items[i].Cells[1].Text;
k++;
ss+=","+s;} }
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >>