本文整理汇总了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);
}
}
}
}
}
}
}
示例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;
}
}
}
示例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;
}
示例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();
}
示例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");
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}