GetDataTable() public method

返回指定查询SQL的DataTable对象
public GetDataTable ( string strSQL ) : DataTable
strSQL string
return DataTable
Beispiel #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        SQL = "select wz_id,标题 from 文章表 where 文档类型='材料发现' ";
        dt  = objConn.GetDataTable(SQL);

        SQL = "select wz_id,标题 from 文章表 where 文档类型='材料导购'";
        dt1 = objConn.GetDataTable(SQL);

        SQL = "select wz_id,标题 from 文章表 where 文档类型='材料评测' ";
        dt2 = objConn.GetDataTable(SQL);

        SQL = "select wz_id,标题 from 文章表 where 文档类型='材料百科' ";
        dt3 = objConn.GetDataTable(SQL);
    }
Beispiel #2
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        DataConn objcon = new DataConn();
        string SQL = "select dw_id,QQ号码,QQ_id,等级,yh_id,类型 from 用户表 where QQ号码='" + this.username.Value + "'";
        DataTable dt_yh = new DataTable();
        dt_yh = objcon.GetDataTable(SQL);
        if (dt_yh != null && dt_yh.Rows.Count > 0)
        {
            string yh_id = "";

            yh_id = dt_yh.Rows[0]["yh_id"].ToString();
            dj = dt_yh.Rows[0]["等级"].ToString();
            QQ = dt_yh.Rows[0]["QQ号码"].ToString();
            gys_id = dt_yh.Rows[0]["dw_id"].ToString();
            string lx = dt_yh.Rows[0]["类型"].ToString();

            Session["GYS_QQ_ID"] = dt_yh.Rows[0]["QQ_id"].ToString();
            Session["GYS_YH_ID"] = yh_id;//蒋,11月07号添加
            Session["QQ号码"] = QQ;
            Session["类型"] = lx;
            Session["dwid"] = gys_id;
            if (dj == "普通用户")
            {
                Response.Write("<script> window.opener.location.href='gyszym.aspx';window.close();</" + "script>");
            }
            else
            {
                Response.Write("<script> window.opener.location.href='hyyhgl.aspx?QQ=" + this.username.Value + "&dw_id=" + gys_id + "';window.close();</" + "script>");
            }
        }
        else
        {
            Response.Write("<script>alert('您的账号未注册!');</" + "script>");
        }
    }
Beispiel #3
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     DataConn objcon = new DataConn();
     string SQL = "select yh_id,QQ_id,等级, QQ号码 from 用户表 where QQ号码='" + this.username.Value + "'";
     DataTable dt_yh = objcon.GetDataTable(SQL);
     if (dt_yh != null && dt_yh.Rows.Count > 0)
     {
         yh_id = dt_yh.Rows[0]["yh_id"].ToString();
         dj=dt_yh.Rows[0]["等级"].ToString();
         Session["CGS_QQ_ID"] = dt_yh.Rows[0]["QQ_id"].ToString();
         Session["CGS_YH_ID"] = yh_id;
         //GYS_YH_ID
         if (dj == "普通用户")
         {
             Response.Write("<script> window.opener.location.href='cgsgl_2.aspx';window.close();</" + "script>");
         }
         else
         {
             Response.Write("<script>window.opener.location.href='hyyhgl.aspx?QQ=" + this.username.Value + "';window.close();</" + "script>");
         }
     }
     else
     {
         Response.Write("<script>alert('您的账号未注册!');</" + "script>");
     }
 }
Beispiel #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        HttpCookie QQ_id = Request.Cookies["QQ_id"];

        if (QQ_id != null)
        {
            SQL   = "select 姓名 from 用户表 where QQ_id='" + QQ_id.Value + "'";
            dt_yh = objConn.GetDataTable(SQL);
        }
    }
Beispiel #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            dt = objConn.GetDataTable("select distinct top 10 供应商 ,gys_id,单位类型 from 材料供应商信息表 where 是否启用=1 order by gys_id");

            this.Items = new List <Manufacturer>();
            for (int x = 0; x < dt.Rows.Count; x++)
            {
                DataRow      dr = dt.Rows[x];
                Manufacturer mf = new Manufacturer();
                mf.Manufacturers = Convert.ToString(dr["供应商"]);
                mf.Type          = Convert.ToString(dr["单位类型"]);
                mf.Gys_id        = Convert.ToString(dr["gys_id"]);
                this.Items.Add(mf);
            }
        }
    }
Beispiel #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     dt_cltp = objConn.GetDataTable("select 存放地址,材料名称,cl_id from 材料多媒体信息表 where  是否上头条='是' and 媒体类型 = '图片' and 大小='小' and cl_id in(select cl_id from 材料表 where 类型='主打')");
 }
Beispiel #7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     //string constr = ConfigurationManager.ConnectionStrings["DBServerName"].ConnectionString;
     objConn = new DataConn();
     dt      = objConn.GetDataTable("select distinct top 10 品牌名称 ,pp_id from 品牌字典 where 是否启用=1 ");
 }
Beispiel #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     dt = objConn.GetDataTable("select top 10 显示名,cl_id,材料编码,fl_id,分类编码 from 材料表 order by fl_id ");
 }
Beispiel #9
0
    string strRunPage; //验证成功后要跳转的页面

    #endregion Fields

    #region Methods

    protected void btnCheck_Click(object sender, ImageClickEventArgs e)
    {
        DataConn dc = new DataConn();
        string QQ = Request.Form["user_qq"];
        string gys_qq_id;
        string cgs_qq_id;
        string sql_Check_QQ;
        string sql_Update_QQ_id;
        string sql_GetData;
        string sql_Level;
        string sql_dwid;

        if (Request.Cookies["GYS_QQ_ID"]!=null)
        {
            gys_qq_id = Request.Cookies["GYS_QQ_ID"].Value.ToString();
            sql_Check_QQ = "select * from 用户表 where QQ号码='" + QQ + "'";
            sql_Update_QQ_id = "update 用户表 set QQ_id = '" + gys_qq_id + "',验证通过时间=getdate(),是否验证通过='通过' where QQ号码='" + QQ + "'";

            sql_GetData = "select 供应商,地址,电话,主页,单位类型,联系人,联系人手机 from 材料供应商信息表 where gys_id=(select dw_id from 用户表 where QQ_id='" + gys_qq_id + "')";

            sql_Level = "select 等级 from 用户表 where QQ_id='" + gys_qq_id + "'";
            sql_dwid = "select dw_id from 用户表 where QQ_id='" + gys_qq_id + "'";
        }
        else
        {
            cgs_qq_id = Request.Cookies["CGS_QQ_ID"].Value.ToString();
            sql_Check_QQ = "select * from 用户表 where QQ号码='" + QQ + "'";
            sql_Update_QQ_id = "update 用户表 set QQ_id = '" + cgs_qq_id + "',验证通过时间=getdate(),是否验证通过='通过' where QQ号码='" + QQ + "'";

            sql_GetData = "select 单位名称,地址,电话,主页,单位类型,联系人,联系人手机 from 采购商基本信息 where cgs_id=(select dw_id from 用户表 where QQ_id='" + cgs_qq_id + "')";

            sql_Level = "select 等级 from 用户表 where QQ_id='" + cgs_qq_id + "'";
            sql_dwid = "select dw_id from 用户表 where QQ_id='" + cgs_qq_id + "'";
        }

        if(dc.GetRowCount(sql_Check_QQ)>0)     //判断QQ号是否存在,即是否已经注册
        {
            //Response.Write("已经注册");
            if (dc.RunSqlTransaction(sql_Update_QQ_id))    //已经注册,则写入QQ_id
            {
                //读取数据
                dtGys = dc.GetDataTable(sql_GetData);
                if (Request.Cookies["GYS_QQ_ID"] != null)
                {
                    for (int i = 0; i < dtGys.Rows.Count; i++)
                    {
                        DataRow dr = dtGys.Rows[i];
                        this.gys_name.Value = dr["供应商"].ToString();
                        this.gys_address.Value = dr["地址"].ToString();
                        this.gys_phone.Value = dr["电话"].ToString();
                        this.gys_homepage.Value = dr["主页"].ToString();
                        this.gslx.Value = dr["单位类型"].ToString();
                        this.user_name.Value = dr["联系人"].ToString();
                        this.user_phone.Value = dr["联系人手机"].ToString();
                    }
                }
                else
                {
                    for (int i = 0; i < dtGys.Rows.Count; i++)
                    {
                        DataRow dr = dtGys.Rows[i];
                        this.gys_name.Value = dr["单位名称"].ToString();
                        this.gys_address.Value = dr["地址"].ToString();
                        this.gys_phone.Value = dr["电话"].ToString();
                        this.gys_homepage.Value = dr["主页"].ToString();
                        this.gslx.Value = dr["单位类型"].ToString();
                        this.user_name.Value = dr["联系人"].ToString();
                        this.user_phone.Value = dr["联系人手机"].ToString();
                    }
                }

                if (dc.DBLook(sql_Level) == "企业用户")
                {
                    strRunPage = "hyyhgl.aspx";
                }
                else if (dc.DBLook(sql_Level) == "普通用户")
                {
                    string dwid = dc.DBLook(sql_dwid);
                    if (Request.Cookies["GYS_QQ_ID"] != null)
                    {
                        strRunPage = "gyszym.aspx?dw_id=" + dwid;
                    }
                    else
                    {
                        strRunPage = "cgsgl_2.aspx?dw_id=" + dwid;
                    }

                }

                Response.Write(@"<script>if(confirm('验证成功,是否现在登录?')==true)
                {window.location.href='" + strRunPage + "';}else{}</script>");

            }
        }
        else
        {
            Response.Write(@"<script>if(confirm('此账户尚未注册,是否现在注册?')==true)
            {window.location.href='hyzcsf.aspx';}else{window.opener=null;window.open('','_self');
            window.close();}</script>");
        }
    }