温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:小范企业管理源码
当前文件路径:XiaoFanWeb/admin/AdminInfo.aspx.cs

1using System; 2
using System.Data; 3
using System.Configuration; 4
using System.Collections; 5
using System.Web; 6
using System.Web.Security; 7
using System.Web.UI; 8
using System.Web.UI.WebControls; 9
using System.Web.UI.WebControls.WebParts; 10
using System.Web.UI.HtmlControls; 11
12
using System.Data.OleDb; 13
public partial class admin_AdminInfo : System.Web.UI.Page 14
{ 15
protected void Page_Load(object sender, EventArgs e) 16
{ 17
huoqu(); 18
} 19
protected void Button1_Click(object sender, EventArgs e) 20
{ 21
try 22
{ 23
string txt1,txt2; 24
txt1=tb_name.Text.ToString(); 25
txt2=Tel.Text.ToString(); 26
if (txt1=="" || txt2=="") 27
{ 28
Response.Redirect("adminInfo.aspx"); 29
} 30
OleDbConnection oledbcon = new OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;data source=" + HttpContext.Current.Server.MapPath(@"~/App_Data/dbs.mdb")); 31
//string cmdString = "update FZ_orders set (Name,Address,Mail,,Tel,Fax,CopyRight,QQ,TimeToTime,URL,Info,Addtime)" + 32
////"values('" + tb_name.Text.ToString() + "''" + Address.Text.ToString() + "'" + 33
//"'" + Email.Text.ToString() + "''" + .Text.ToString() + "''" + Tel.Text.ToString() + "'" + 34
//"'" + Fax.Text.ToString() + "''" + CopyRight.Text.ToString() + "''" + QQ.Text.ToString() + "'" + 35
//"'" + TimeToTime.Text.ToString() + "''" + URL.Text.ToString() + "''" + Info.Text.ToString() + "''" + DateTime.Now + "')"; 36
//更新数据代码 37
string upString = "update FZ_orders set Name='" + tb_name.Text.ToString() + "',"+ 38
"Address='" + Address.Text.ToString() + "'," + 39
"Mail='" + Email.Text.ToString() + "',"+ 40
"Zip='" + Zip.Text.ToString() + "'," + 41
"Tel='" + Tel.Text.ToString() + "'," + 42
"Fax='" + Fax.Text.ToString() + "'," + 43
"CopyRight='" + CopyRight.Text.ToString() + "'," + 44
"QQ='" + QQ.Text.ToString() + "'," + 45
"TimeToTime='" + TimeToTime.Text.ToString() + "'," + 46
"URL='" + URL.Text.ToString() + "'," + 47
"Info='" + Info.Text.ToString() + "'," + 48
"Addtime='" +DateTime.Now+ "'"; 49
50
oledbcon.Open(); 51
OleDbCommand cmd = new OleDbCommand(upString, oledbcon); 52
cmd.ExecuteNonQuery(); 53
oledbcon.Close(); 54
55
} 56
catch(Exception M) 57
{ 58
Response.Write(M.Message); 59
} 60
finally 61
{ 62
huoqu(); 63
} 64
} 65
protected void huoqu() 66
{ 67
if (!IsPostBack) 68
{ 69
try 70
{ 71
OleDbConnection oledbcon = new OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;data source=" + HttpContext.Current.Server.MapPath(@"~/App_Data/dbs.mdb")); 72
string cmdString = "select * from FZ_orders"; 73
oledbcon.Open(); 74
OleDbDataAdapter oda = new OleDbDataAdapter(cmdString, oledbcon); 75
DataSet ds = new DataSet(); 76
oda.Fill(ds, "temp"); 77
tb_name.Text = ds.Tables["temp"].Rows[0]["Name"].ToString(); 78
Address.Text = ds.Tables["temp"].Rows[0]["Address"].ToString(); 79
Email.Text = ds.Tables["temp"].Rows[0]["Mail"].ToString(); 80
Zip.Text = ds.Tables["temp"].Rows[0]["Zip"].ToString(); 81
Tel.Text = ds.Tables["temp"].Rows[0]["Tel"].ToString(); 82
Fax.Text = ds.Tables["temp"].Rows[0]["Fax"].ToString(); 83
CopyRight.Text = ds.Tables["temp"].Rows[0]["CopyRight"].ToString(); 84
QQ.Text = ds.Tables["temp"].Rows[0]["QQ"].ToString(); 85
TimeToTime.Text = ds.Tables["temp"].Rows[0]["TimeToTime"].ToString(); 86
URL.Text = ds.Tables["temp"].Rows[0]["URL"].ToString(); 87
Info.Text = ds.Tables["temp"].Rows[0]["Info"].ToString(); 88
oledbcon.Close(); 89
} 90
catch (Exception M) 91
{ 92
Response.Write(M.Message); 93
} 94
} 95
} 96
} 97





}
}