62,046
社区成员
发帖
与我相关
我的任务
分享
protected void Page_Load(object sender, EventArgs e)
{
try
{
OleDbConnection acccon = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("bfjDb/bfj.mdb").ToString());
string Selectcmd = "select I_content from introduct where IID=" + 1;
OleDbCommand acccomm = new OleDbCommand(Selectcmd, acccon);
acccon.Open();
OleDbDataReader reca = acccomm.ExecuteReader();
string data="";
while (reca.Read())
{
data = reca["I_content"].ToString();
}
Response.Write(data);
reca.Close();
acccon.Close();
}
catch (Exception ex)
{
Response.Write("<script language=JavaScript> alert('" + ex + "');</script>");
}
}
protected void Button1_Click(object sender, EventArgs e)
{
//OleDbConnection acccon = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("bfjDb/bfj.mdb").ToString());
//string Updatecmd = "update introduct set I_content='" + FCKeditor1.Value + "' where IID="+1;
//OleDbCommand acccomm = new OleDbCommand(Updatecmd, acccon);
try
{
OleDbConnection acccon = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("bfjDb/bfj.mdb").ToString());
string Updatecmd = "update introduct set I_content='" + FCKeditor1.Value + "' where IID=" + 1;
OleDbCommand acccomm = new OleDbCommand(Updatecmd, acccon);
acccon.Open();
acccomm.ExecuteNonQuery();
acccon.Close();
Response.Write("<script language=JavaScript> alert('发表成功!');</script>");
}
catch(Exception ex)
{
Response.Write("<script language=JavaScript> alert('"+ex+"');</script>");
}
}
if(!IsPostBack)
{
try
{
OleDbConnection acccon = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("bfjDb/bfj.mdb").ToString());
string Selectcmd = "select I_content from introduct where IID=" + 1;
OleDbCommand acccomm = new OleDbCommand(Selectcmd, acccon);
acccon.Open();
OleDbDataReader reca = acccomm.ExecuteReader();
string data="";
while (reca.Read())
{
data = reca["I_content"].ToString();
}
Response.Write(data);
reca.Close();
acccon.Close();
}
catch (Exception ex)
{
Response.Write("<script language=JavaScript> alert('" + ex + "');</script>");
}
}