test.aspx.cs
资源名称:web.rar [点击查看]
上传用户:xrffrp
上传日期:2022-03-25
资源大小:22155k
文件大小:2k
源码类别:
OA系统
开发平台:
ASP/ASPX
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- using System.Data.SqlClient;
- public partial class web_test : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- ArrayList id1 = new ArrayList();
- ArrayList last_id = new ArrayList();
- SqlConnection conn = dbConnection.getConnection();
- conn.Open();
- SqlCommand cmd = new SqlCommand("select a.id as id,b.id as id1 from oa_employee as a left join oa_department as b on a.department_id=b.id" +
- " where position< 8 and department_id=39 order by position desc", conn);
- // cmd.Transaction = tx;
- SqlDataReader dr = cmd.ExecuteReader();
- while (dr.Read())
- {
- id1.Add(dr["id"].ToString());
- last_id.Add(dr["id1"].ToString());
- }
- dr.Close();
- for (int j = 1; j < 5; j++)
- {
- cmd = new SqlCommand("select last_id from oa_department where id=" + last_id[j - 1], conn);
- // cmd.Transaction = tx;
- SqlDataReader dr2 = cmd.ExecuteReader();
- while (dr2.Read())
- {
- last_id.Add(dr2["last_id"].ToString());
- Response.Write(last_id[j]);
- }
- dr2.Close();
- }
- }
- }