{
string sql;
sql = "select * from alllb order by id desc";
getdata(sql);
}
}
private void getdata(string sql)
{
DataSet result = new DataSet();
result = new Class1().hsggetdata(sql);
if (result != null)
{
if (result.Tables[0].Rows.Count > 0)
{
int k = 0;
for (k = 0; k < result.Tables[0].Rows.Count; k++)
{
lb.Items.Add(result.Tables[0].Rows[k]["lb"].ToString().Trim());
}
}
}
}
private void hsgupload()
{
if (UploadFile.Value != null)
{
string nam = UploadFile.PostedFile.FileName;
//取得文件名(抱括路径)里最后一个"."的索引
int i = nam.LastIndexOf(".");
//取得文件扩展名
string newext = nam.Substring(i);
//这里自动根据日期和文件大小不同为文件命名,确保文件名不重复
DateTime now = DateTime.Now;
string newname = now.DayOfYear.ToString() + UploadFile.PostedFile.ContentLength.ToString();
//保存文件到你所要的目录,这里是IIS根目录下的uploadfiles目录
//注意: 这里用Server.MapPath()取当前文件的绝对目录.在asp.net里"\"必须用"\\"代替
UploadFile.PostedFile.SaveAs(Server.MapPath("uppic/" + newname + newext));
//得到这个文件的相关属性:文件名,文件类型,文件大小
//string fname;
fname = newname + newext;
//Response.Write("<script>javascript:alert('"+fname+"');</script>");
//fenc.Text=UploadFile.PostedFile.ContentType ; ASP.net+sqlserver企业网站设计+流程图+用例ER图(18):http://www.youerw.com/jisuanji/lunwen_338.html