当前位置: 首页>>代码示例>>C#>>正文


C# SqlDatabase.ExecuteDataSet方法代码示例

本文整理汇总了C#中Microsoft.Practices.EnterpriseLibrary.Data.Sql.SqlDatabase.ExecuteDataSet方法的典型用法代码示例。如果您正苦于以下问题:C# SqlDatabase.ExecuteDataSet方法的具体用法?C# SqlDatabase.ExecuteDataSet怎么用?C# SqlDatabase.ExecuteDataSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Practices.EnterpriseLibrary.Data.Sql.SqlDatabase的用法示例。


在下文中一共展示了SqlDatabase.ExecuteDataSet方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request["paperid"] != null)
                {
                    string pid = Request["paperid"].ToString();
                    string viewrs = Request["viewrs"].ToString();
                    string viewdata = string.Empty;

                    if (Request["viewdata"] != null)
                    {
                        viewdata = Request["viewdata"].ToString();
                    }

                    if (!string.IsNullOrEmpty(pid))
                    {
                        Database objDB = new SqlDatabase(M_CONSTR);
                        if (objDB != null)
                        {
                            DataSet ds = objDB.ExecuteDataSet(CommandType.Text,
                                    @"SELECT * FROM Table_PAPER WHERE PAPERID=" + pid);
                            if (ds != null && ds.Tables[0].Rows.Count.Equals(1))
                            {
                                string pType = ds.Tables[0].Rows[0]["PaperClassID"].ToString();

                                if (pType.Equals("1"))//完整版问卷
                                {
                                    if (!string.IsNullOrEmpty(viewrs))
                                    {
                                        if (!string.IsNullOrEmpty(viewdata))
                                        {
                                            Response.Redirect("~/report/dbbgdata.aspx?paperid=" + pid + "&viewdata=true");
                                        }
                                        Response.Redirect("~/report/dbbg.aspx?paperid=" + pid);
                                    }
                                    Response.Redirect("wz.aspx?paperid=" + pid);
                                }
                                else if (pType.Equals("2"))//讲师版问卷
                                {
                                    if (!string.IsNullOrEmpty(viewrs))
                                    {
                                        if (!string.IsNullOrEmpty(viewdata))
                                        {
                                            Response.Redirect("~/report/jsbgdata.aspx?paperid=" + pid + "&viewdata=true");
                                        }
                                        Response.Redirect("~/report/NotAllow.aspx");
                                    }
                                    Response.Redirect("js.aspx?paperid=" + pid);
                                }
                            }
                        }
                    }
                }
            }
        }
开发者ID:conghuiw,项目名称:dcwj,代码行数:56,代码来源:router.aspx.cs

示例2: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Database objDB = new SqlDatabase(M_CONSTR);
                if (objDB != null)
                {
                    //所属部门
                    DataSet ds = objDB.ExecuteDataSet(CommandType.Text, "SELECT * FROM Table_Group");
                    ddlTGroup.DataSource = ds.Tables[0];
                    ddlTGroup.DataTextField = "GroupName";
                    ddlTGroup.DataValueField = "GroupID";
                    ddlTGroup.DataBind();
                    ddlTGroup.Items.Insert(0, (new ListItem("--全部--", "0")));
                    ddlTGroup.SelectedIndex = 0;

                    //讲师
                    ds = objDB.ExecuteDataSet(CommandType.Text, "SELECT * FROM Table_TEACHER");
                    ddlTeacher.DataSource = ds.Tables[0];
                    ddlTeacher.DataTextField = "TeacherName";
                    ddlTeacher.DataValueField = "TeacherID";
                    ddlTeacher.DataBind();
                    //ddlTeacher.Items.Insert(0, (new ListItem("--全部--", "0")));
                    //ddlTeacher.SelectedIndex = 0;
                }
            }
        }
开发者ID:conghuiw,项目名称:dcwj,代码行数:27,代码来源:selteacher.aspx.cs

示例3: GetResources

        public static DataTable GetResources(int jobId, int deptId)
        {
            SqlDatabase db = new SqlDatabase(connString);
            string sql = @" SELECT	U.UserId, U.FirstName + ' ' + U.LastName AS FullName, 
		                            t.TitleName as Title
                            FROM	AllocableUsers U LEFT JOIN JobTitles AS t ON U.currentTitleID=t.TitleID
                            WHERE	U.Active=1 AND U.UserId NOT IN (
                                    SELECT UserId FROM Assignments WHERE [email protected]_id
                                    AND (EndDate IS NULL OR EndDate>DATEADD(s, 1, CURRENT_TIMESTAMP))) 
                                    AND [email protected]_id AND realPerson='Y'
		                            AND UserId NOT IN (
			                            SELECT	UserId
			                            FROM	timeEntry
			                            WHERE	[email protected]_id AND UserId=U.UserId AND (TimeSpan IS NULL OR TimeSpan > 0)
		                            )
                            ORDER BY FullName";

            DbCommand command = db.GetSqlStringCommand(sql);
            db.AddInParameter(command, "@job_id", DbType.Int32, jobId);
            db.AddInParameter(command, "@dept_id", DbType.Int32, deptId);
            DataTable t = new DataTable();
            t = db.ExecuteDataSet(command).Tables[0].Copy();
            t.TableName = "Resources";
            command.Dispose();
            return t;
        }
开发者ID:the0ther,项目名称:how2www.info,代码行数:26,代码来源:ManageAssignments.cs

示例4: Page_Load

        protected void Page_Load( object sender, EventArgs e )
        {
            SqlDatabase db = new SqlDatabase( System.Configuration.ConfigurationManager.AppSettings["ConnectionString"] );

            // get game information
            int gameid = Convert.ToInt32( Request["GameId"] );
            //            DataSet dsGameInfo = SqlHelper.ExecuteDataset( System.Configuration.ConfigurationManager.AppSettings["ConnectionString"],
            //                "spGetGameDetails", gameid );
            DataSet dsGameInfo = db.ExecuteDataSet( "spGetGameDetails", gameid );
            int hometeamid = (int)dsGameInfo.Tables[0].Rows[0]["hometeamid"];
            int awayteamid = (int)dsGameInfo.Tables[0].Rows[0]["visitorteamid"];

            lblPageTitle.Text = "Week " + dsGameInfo.Tables[0].Rows[0]["Week"].ToString()
                + ": " + dsGameInfo.Tables[0].Rows[0]["visitor"].ToString()
                + " " + dsGameInfo.Tables[0].Rows[0]["visitorscore"].ToString()
                + " @ " + dsGameInfo.Tables[0].Rows[0]["home"].ToString()
                + " " + dsGameInfo.Tables[0].Rows[0]["homescore"].ToString();
            lblHome.Text = dsGameInfo.Tables[0].Rows[0]["home"].ToString();
            lblAway.Text = dsGameInfo.Tables[0].Rows[0]["visitor"].ToString();

            if( dsGameInfo.Tables[0].Rows[0]["HomeWins"] != DBNull.Value )
            {
                lblGameScore.Text = dsGameInfo.Tables[0].Rows[0]["visitor"].ToString()
                + " wins " + dsGameInfo.Tables[0].Rows[0]["visitorwins"].ToString()
                + " games, " + dsGameInfo.Tables[0].Rows[0]["home"].ToString()
                + " wins " + dsGameInfo.Tables[0].Rows[0]["homewins"].ToString()
                + " games";
            }

            // get the team boxes
            //DataSet dsHome = SqlHelper.ExecuteDataset( System.Configuration.ConfigurationManager.AppSettings["ConnectionString"],
            //    "spGetTeamContributions", gameid, hometeamid );
            DataSet dsHome = db.ExecuteDataSet( "spGetTeamContributions", gameid, hometeamid );
            AddSummaryData( dsHome );
            dgHome.DataSource = dsHome;
            dgHome.DataBind();

            //DataSet dsAway = SqlHelper.ExecuteDataset( System.Configuration.ConfigurationManager.AppSettings["ConnectionString"],
            //    "spGetTeamContributions", gameid, awayteamid );
            DataSet dsAway = db.ExecuteDataSet( "spGetTeamContributions", gameid, awayteamid );
            AddSummaryData( dsAway );
            dgAway.DataSource = dsAway;
            dgAway.DataBind();
        }
开发者ID:ohri,项目名称:netcaa,代码行数:44,代码来源:BoxScore.aspx.cs

示例5: btnlist_Click

 protected void btnlist_Click(object sender, EventArgs e)
 {
     int test = 0;
     DataSet ds;
     Database objDataBase = new Microsoft.Practices.EnterpriseLibrary.Data.Sql.SqlDatabase(@"Server=d9deq4jc9e.database.windows.net;Database=kadsysv2;User id=jegan;Password=DBXPose!123;");
     //Database objDataBase = new Microsoft.Practices.EnterpriseLibrary.Data.Sql.SqlDatabase(@"Server=bgtnhy\sql2008;Database=KadSysV2;User id=kaduser;Password=kad123;");
     ds = objDataBase.ExecuteDataSet(CommandType.Text, TextBox1.Text);
     objDataBase = null;
     Response.Write(ds.Tables[0].Rows[0][0].ToString());
     Response.Write("Done");
 }
开发者ID:jeganathans,项目名称:kadsys,代码行数:11,代码来源:temp.aspx.cs

示例6: ddlTGroup_SelectedIndexChanged

 protected void ddlTGroup_SelectedIndexChanged(object sender, EventArgs e)
 {
     ddlTeacher.Items.Clear();
     Database objDB = new SqlDatabase(M_CONSTR);
     DataSet ds = objDB.ExecuteDataSet(CommandType.Text, "SELECT * FROM Table_TEACHER where groupid=" + ddlTGroup.SelectedValue);
     ddlTeacher.DataSource = ds.Tables[0];
     ddlTeacher.DataTextField = "TeacherName";
     ddlTeacher.DataValueField = "TeacherID";
     ddlTeacher.DataBind();
     ddlTeacher.Items.Insert(0, (new ListItem("--全部--", "0")));
     ddlTeacher.SelectedIndex = 0;
 }
开发者ID:conghuiw,项目名称:dcwj,代码行数:12,代码来源:selteacher.aspx.cs

示例7: ObtenerDataSet

        public DataSet ObtenerDataSet(string conexion, string procedimiento, List<DbParameter> parametros)
        {
            var bd = new SqlDatabase(conexion);
            DbCommand cmd = bd.GetStoredProcCommand(procedimiento);

            EstablecerParametros(parametros, bd, cmd);

            DataSet ds = bd.ExecuteDataSet(cmd);

            ObtenerParametrosOut(parametros, cmd);

            return ds;
        }
开发者ID:JeyssonRamirez,项目名称:NLayer,代码行数:13,代码来源:AccesoDual.cs

示例8: AllocatedJobs

 private static DataTable AllocatedJobs(int region, int startWeek)
 {
     SqlDatabase db = new SqlDatabase(connString);
     DbCommand command = db.GetStoredProcCommand("ALOC_RegionGridJobListSelect");
     command.CommandType = CommandType.StoredProcedure;
     db.AddInParameter(command, "@RegionId", DbType.Int32, region);
     db.AddInParameter(command, "@StartWeek", DbType.Int32, startWeek);
     DataTable dt = null;
     dt = db.ExecuteDataSet(command).Tables[0].Copy();
     dt.TableName = "Jobs";
     command.Dispose();
     return dt;
 }
开发者ID:the0ther,项目名称:how2www.info,代码行数:13,代码来源:RegionGrid.cs

示例9: Availability

        private static DataTable Availability(int empId, int weekNumber)
        {
            SqlDatabase db = new SqlDatabase(connString);

            DbCommand command = db.GetStoredProcCommand("ALOC_EmpGridAvailability");
            db.AddInParameter(command, "@userId", DbType.Int32, empId);
            db.AddInParameter(command, "@weekNumber", DbType.Int32, weekNumber);
            DataTable t = new DataTable();
            t = db.ExecuteDataSet(command).Tables[0].Copy();
            t.TableName = "Availability";
            command.Dispose();

            return t;            
        }
开发者ID:the0ther,项目名称:how2www.info,代码行数:14,代码来源:EmpGrid.cs

示例10: AllocatedUsers

 private static DataTable AllocatedUsers(int region, int startWeek, int deptId, string resType)
 {
     SqlDatabase db = new SqlDatabase(connString);
     DbCommand command = db.GetStoredProcCommand("ALOC_RegionGridUserListSelect");
     command.CommandType = CommandType.StoredProcedure;
     db.AddInParameter(command, "@RegionId", DbType.Int32, region);
     db.AddInParameter(command, "@StartWeek", DbType.Int32, startWeek);
     db.AddInParameter(command, "@DepartmentId", DbType.Int32, deptId);
     db.AddInParameter(command, "@ResourceType", DbType.String, resType);
     DataTable dt = null;
     dt = db.ExecuteDataSet(command).Tables[0].Copy();
     dt.TableName = "User";
     command.Dispose();
     return dt;
 }
开发者ID:the0ther,项目名称:how2www.info,代码行数:15,代码来源:RegionGrid.cs

示例11: AllocatedDepts

        private static DataTable AllocatedDepts(int clientId, int startWeek, int jobId)
        {
            SqlDatabase db = new SqlDatabase(connString);

            DbCommand command = db.GetStoredProcCommand("ALOC_ProjectGridDeptSelect");
            command.CommandType = CommandType.StoredProcedure;
            db.AddInParameter(command, "@client_id", DbType.Int32, clientId);
            db.AddInParameter(command, "@start_week", DbType.Int32, startWeek);
            db.AddInParameter(command, "@job_id", DbType.Int32, jobId);
            DataTable t = new DataTable();
            t = db.ExecuteDataSet(command).Tables[0].Copy();
            t.TableName = "Depts";
            command.Dispose();

            return t;
        }
开发者ID:the0ther,项目名称:how2www.info,代码行数:16,代码来源:ProjectGrid.cs

示例12: ClientTeams

 public static DataTable ClientTeams(int clientId)
 {
     SqlDatabase db = new SqlDatabase(connString);
     DbCommand command = db.GetSqlStringCommand(@"
             SELECT  TeamID, Name, Description 
             FROM    ALOC_Teams 
             WHERE   [email protected]_id 
             ORDER BY Name
         ");
     command.CommandType = CommandType.Text;
     db.AddInParameter(command, "@client_id", DbType.Int32, clientId);
     DataTable t = new DataTable();
     t = db.ExecuteDataSet(command).Tables[0].Copy();
     t.TableName = "Teams";
     command.Dispose();
     return t;
 }
开发者ID:the0ther,项目名称:how2www.info,代码行数:17,代码来源:TeamGrid.cs

示例13: AllocatedJobs

        private static DataTable AllocatedJobs( int clientId, int startWeek, string resourceType )
        {
            SqlDatabase db = new SqlDatabase( connString );

            DbCommand command = db.GetStoredProcCommand( "ALOC__TeamGridJobListSelect" );
            command.CommandType = CommandType.StoredProcedure;
            db.AddInParameter( command, "@ClientId", DbType.Int32, clientId );
            db.AddInParameter( command, "@StartWeek", DbType.Int32, startWeek );
            db.AddInParameter( command, "@Type", DbType.String, resourceType );

            DataTable t = new DataTable();
            t = db.ExecuteDataSet( command ).Tables[0].Copy();
            t.TableName = "Job";
            command.Dispose();

            return t;

        }
开发者ID:the0ther,项目名称:how2www.info,代码行数:18,代码来源:TeamGrid.cs

示例14: ObtenerDataTable

        public DataTable ObtenerDataTable(string conexion, string procedimiento, List<DbParameter> parametros)
        {
            DataTable dt = null;

            var bd = new SqlDatabase(conexion);
            DbCommand cmd = bd.GetStoredProcCommand(procedimiento);

            EstablecerParametros(parametros, bd, cmd);

            DataSet ds = bd.ExecuteDataSet(cmd);

            ObtenerParametrosOut(parametros, cmd);

            if (ds != null && ds.Tables.Count > 0)
            {
                dt = ds.Tables[0];
            }

            return dt;
        }
开发者ID:JeyssonRamirez,项目名称:NLayer,代码行数:20,代码来源:AccesoDual.cs

示例15: AllocatedEmps

        private static DataTable AllocatedEmps(int clientId, int startWeek, int jobId, string resType, int region)
        {
            SqlDatabase db = new SqlDatabase(connString);

            DbCommand command = db.GetStoredProcCommand("ALOC_ProjectGridEmpsSelect");
            command.CommandType = CommandType.StoredProcedure;
            db.AddInParameter(command, "@client_id", DbType.Int32, clientId);
            db.AddInParameter(command, "@start_week", DbType.Int32, startWeek);
            //TODO: why is this setting @dept_id to Zero?
            db.AddInParameter(command, "@dept_id", DbType.Int32, 0);
            db.AddInParameter(command, "@job_id", DbType.Int32, jobId);
            db.AddInParameter(command, "@resource_type", DbType.String, resType);
            db.AddInParameter(command, "@region", DbType.Int32, region);
            DataTable t = new DataTable();
            t = db.ExecuteDataSet(command).Tables[0].Copy();
            t.TableName = "Emps";
            command.Dispose();

            return t;
        }
开发者ID:the0ther,项目名称:how2www.info,代码行数:20,代码来源:ProjectGrid.cs


注:本文中的Microsoft.Practices.EnterpriseLibrary.Data.Sql.SqlDatabase.ExecuteDataSet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。