{
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();