-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTechDetails.aspx.cs
58 lines (51 loc) · 2.49 KB
/
TechDetails.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.OleDb;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class TechDetails : System.Web.UI.Page
{
int TechArticleID = 0;
public string strArticleContents = string.Empty;
public string strContactInf = string.Empty;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
(Page.Master.FindControl("ProductsClassTreeView") as TreeView).ExpandDepth = 0;
string strConnection = ConfigurationManager.ConnectionStrings["AccessConnectionString"].ConnectionString;
OleDbConnection objConnection = new OleDbConnection(strConnection);
objConnection.Open();
using (objConnection)
{
string _sql = "SELECT * FROM XXTable";
OleDbDataAdapter da = new OleDbDataAdapter(_sql, objConnection);
DataSet ds = new DataSet(); //填充DataSet
da.Fill(ds, "nb");
DataTable _dt = ds.Tables["nb"];
strContactInf = _dt.Rows[0]["LXFS"].ToString();
if (Request.QueryString["articleID"].Length != 0)
{
TechArticleID = int.Parse(Request.QueryString["articleID"]);
//OleDbConnection objConnection = new OleDbConnection(strConnection);
//objConnection.Open();
_sql = "SELECT * FROM JSZCTable WHERE 编号=" + TechArticleID.ToString();
da = new OleDbDataAdapter(_sql, objConnection);
// DataSet ds = new DataSet();
da.Fill(ds, "article");
DataTable dt = ds.Tables["article"];
Page.Title = ArticleTitleLabel.Text = dt.Rows[0]["articleTitle"].ToString();
ArticleTimeLabel.Text = dt.Rows[0]["articleTime"].ToString();
strArticleContents = dt.Rows[0]["articleContents"].ToString();
ArticleClickTimesLabel.Text = dt.Rows[0]["articleClickTimes"].ToString();
_sql = string.Format("UPDATE JSZCTable SET articleClickTimes ={0} WHERE 编号={1}", int.Parse(ArticleClickTimesLabel.Text) + 1, TechArticleID);
OleDbCommand updateCmd = new OleDbCommand(_sql, objConnection);
updateCmd.ExecuteNonQuery();
}
}
}
}
}