本文整理汇总了C#中DataBase.ExCommand方法的典型用法代码示例。如果您正苦于以下问题:C# DataBase.ExCommand方法的具体用法?C# DataBase.ExCommand怎么用?C# DataBase.ExCommand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataBase
的用法示例。
在下文中一共展示了DataBase.ExCommand方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
/// <summary>
/// Page_Load
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
/*实例化一个数据库*/
DataBase db = new DataBase();
/* 统计现有代码数 */
DataSet rs2 = db.ExCommand("SELECT COUNT(*) FROM tb_code");
string intNum2 = rs2.Tables[0].Rows[0][0].ToString();
code_num.Text = intNum2;
/* 统计现有注释数 */
DataSet rs3 = db.ExCommand("SELECT COUNT(*) FROM tb_note");
string intNum3 = rs3.Tables[0].Rows[0][0].ToString();
note_num.Text = intNum3;
/* 统计现有评论数 */
DataSet rs1 = db.ExCommand("SELECT COUNT(*) FROM tb_comment");
string intNum1 = rs1.Tables[0].Rows[0][0].ToString();
comment_num.Text = intNum1;
/* 统计现有会员数 */
DataSet rs = db.ExCommand("SELECT COUNT(*) FROM tb_user");
string intNum = rs.Tables[0].Rows[0][0].ToString();
user_num.Text = intNum;
}
示例2: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//判断是否存在该id的工程
int id = int.Parse(Request.QueryString["id"].ToString());
ProjectEntity pe = ProjectOperation.GetProject(int.Parse(Request.QueryString["id"].ToString()));
if (pe == null)
{
SmallScript.MessageBox(Page, "不存在该工程!点击返回!");
SmallScript.GoBack(Page);
return;
}
else
{
//在表单中显示数据
DataBase db = new DataBase();
DataSet sql = db.ExCommand(string.Format("SELECT tb_project.tid, tb_project.uid, tb_user.userName, "
+ "tb_project.description, tb_project.upTime, "
+ "tb_project.projectName, tb_type.typeName, tb_project.id FROM tb_project INNER "
+ "JOIN tb_type ON tb_project.tid = tb_type.id INNER JOIN tb_user ON tb_project.uid = tb_user.id WHERE (tb_project.id ={0} ) ",id));
string User= sql.Tables[0].Rows[0][2].ToString();
string Type = sql.Tables[0].Rows[0][0].ToString();
tb_ProjectName.Text = pe.ProjectName;
lb_User.Text = User;
db_Type.SelectedIndex =int.Parse(Type);
tb_description.Text = pe.Description;
lb_UpTime.Text = pe.UpTime.ToString();
lb_ID.Text = pe.Id.ToString();
}
}
}
示例3: Page_Load
/// <summary>
/// Page_Load
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//判断是否存在该id的公告
int id = int.Parse(Request.QueryString["id"].ToString());
AnnouncementEntity ae = AnnouncementOperation.GetAM(int.Parse(Request.QueryString["id"].ToString()));
if (ae == null)
{
SmallScript.MessageBox(Page, "不存在该公告!点击返回!");
SmallScript.GoBack(Page);
return;
}
else
{
//在表单中显示数据
DataBase db = new DataBase();
DataSet sql = db.ExCommand(string.Format("SELECT tb_announcement.id, tb_announcement.uid, tb_announcement.amtitle, tb_announcement.essay, tb_announcement.uptime, tb_user.userName FROM tb_announcement INNER JOIN tb_user ON tb_announcement.uid = tb_user.id WHERE (tb_announcement.id ={0} )", id));
string User = sql.Tables[0].Rows[0]["userName"].ToString();
lb_ID.Text = ae.Id.ToString();
tb_amtitle.Text = ae.AmTitle;
lb_User.Text = User;
lb_essay.Text = ae.Essay;
lb_UpTime.Text =ae.Time.ToString();
}
}
}
示例4: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
int id = int.Parse(Request.QueryString["id"].ToString());
ProjectEntity pe = ProjectOperation.GetProject(int.Parse(Request.QueryString["id"].ToString()));
if (pe != null)
{
DataBase db = new DataBase();
DataSet sql = db.ExCommand(string.Format("SELECT tb_project.tid, tb_project.uid, tb_user.userName, "
+ "tb_project.description, tb_project.upTime, "
+ "tb_project.projectName, tb_type.typeName, tb_project.id FROM tb_project INNER "
+ "JOIN tb_type ON tb_project.tid = tb_type.id INNER JOIN tb_user ON tb_project.uid = tb_user.id WHERE (tb_project.id ={0} ) ", id));
string User = sql.Tables[0].Rows[0]["userName"].ToString();
string Type = sql.Tables[0].Rows[0]["typeName"].ToString();
//在表单中显示数据
lb_ProjectName.Text = pe.ProjectName;
lb_Id.Text = pe.Id.ToString();
lb_description.Text = pe.Description;
lb_User.Text = User;
lb_UpTime.Text = pe.UpTime.ToString();
lb_Type.Text = Type;
}
}
}
示例5: DataBind
public override void DataBind()
{
lbPage.Text = page.ToString();
DataBase db = new DataBase();
DataSet ds = db.ExCommand("SELECT tb_project.projectName, tb_user.userName, tb_project.id, tb_project.uid, tb_project.description, tb_project.upTime, tb_type.typeName, tb_project.tid FROM tb_project INNER JOIN tb_type ON tb_project.tid = tb_type.id INNER JOIN tb_user ON tb_project.uid = tb_user.id");
DataOperate.dlBind(8, ds, lbPage, lbtpage, lbtnUp, lbtnnext, lbtnback, lbtnone, this.DataList1);
base.DataBind();
}
示例6: DataBind
public override void DataBind()
{
/*实例化数据库*/
lbPage.Text = page.ToString();
DataBase db = new DataBase();
/*查询语句*/
DataSet ds = db.ExCommand("SELECT tb_note.id, tb_note.uid, tb_note.cid, tb_code.pid, tb_note.upTime, tb_note.context, tb_note.startLine, tb_note.endLine, tb_note.agree, tb_note.disagree, tb_code.path, tb_project.projectName, tb_user.userName FROM tb_code INNER JOIN tb_note ON tb_code.id = tb_note.cid INNER JOIN tb_user ON tb_note.uid = tb_user.id INNER JOIN tb_project ON tb_code.pid = tb_project.id ORDER BY tb_note.upTime DESC");
DataOperate.dlBind(6, ds, lbPage, lbtpage, lbtnUp, lbtnnext, lbtnback, lbtnone, this.DataList1);
base.DataBind();
}
示例7: CheckUser
/* 用户名密码验证 */
/// <summary>
/// 检查用户是否存在
/// </summary>
/// <param name="userName">用户名</param>
/// <returns>注册成功为true,失败为false</returns>
public static bool CheckUser(string userName)
{
DataBase db = new DataBase();
if (db.ExCommand("select * from tb_user where username='" + userName + "'").Tables[0].Rows.Count > 0)
{
return true;
}
else
{ return false; }
}
示例8: CheckProjectNameExist
/// <summary>
/// 检查工程名是否存在
/// </summary>
/// <param name="projectName">工程名</param>
/// <param name="projectId">工程ID</param>
/// <returns></returns>
public static bool CheckProjectNameExist(string projectName, int projectId)
{
DataBase db = new DataBase();
string sql = string.Format("select * from tb_project where projectName='{0}' and id != {1}", projectName,projectId);
if (db.ExCommand(sql).Tables[0].Rows.Count > 0)
{
return true;
}
else
{
return false;
}
}
示例9: AddCode
/// <summary>
/// 添加代码
/// </summary>
/// <param name="ce">代码实体</param>
/// <returns></returns>
public static bool AddCode(CodeEntity ce)
{
DataBase db = new DataBase();
try
{
db.ExCommand("INSERT INTO tb_code ( pid, uid, lid,path) VALUES (" + ce.Pid + "," + ce.Uid + "," + ce.Lid + ",'" + ce.Path + "')");
return true;
}
catch
{
return false;
}
}
示例10: GetLang
public static LangEntity GetLang(int id)
{
DataBase db = new DataBase();
DataSet ds = db.ExCommand("select * from tb_lang where id=" + id.ToString());
LangEntity le = new LangEntity();
le.Id = (int)ds.Tables[0].Rows[0]["id"];
le.Name = ds.Tables[0].Rows[0]["name"].ToString();
le.Description = ds.Tables[0].Rows[0]["description"].ToString();
le.Ext = ds.Tables[0].Rows[0]["ext"].ToString();
le.BrushName = ds.Tables[0].Rows[0]["brushname"].ToString();
le.BrushFile = ds.Tables[0].Rows[0]["brushfile"].ToString();
le.BrushAliases = ds.Tables[0].Rows[0]["brushaliases"].ToString();
return le;
}
示例11: Page_Load
/// <summary>
/// Page_Load
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
DataBase db = new DataBase();
string rs = "";
DataSet ds_rs = db.ExCommand("select * from tb_note where startline=" + Request.QueryString["startline"].ToString() +
" and recommend=1");
if (ds_rs.Tables[0].Rows.Count > 0)
{
rs = "1";
}
else
{
rs = "0";
}
Response.Write("{\"data\":\"" + Request.QueryString["startline"].ToString() + "\",\"status\":\"" + rs + "\",\"count\":\"" +
Request.QueryString["count"].ToString() + "\"}");
}
示例12: GetCode
/// <summary>
/// 获取源代码信息
/// </summary>
/// <param name="id">源码ID</param>
/// <returns>返回源码的实例</returns>
public static CodeEntity GetCode(int id)
{
DataBase db = new DataBase();
DataSet ds = db.ExCommand("select * from tb_code where id=" + id.ToString());
CodeEntity ce = new CodeEntity();
try
{
ce.Id = (int)ds.Tables[0].Rows[0]["id"];
ce.Pid = int.Parse(ds.Tables[0].Rows[0]["pid"].ToString());
ce.UpTime = DateTime.Parse(ds.Tables[0].Rows[0]["uptime"].ToString());
ce.Uid = int.Parse(ds.Tables[0].Rows[0]["uid"].ToString());
ce.Lid = int.Parse(ds.Tables[0].Rows[0]["lid"].ToString());
ce.Path = ds.Tables[0].Rows[0]["path"].ToString();
return ce;
}
catch
{
return null;
}
}
示例13: Page_Load
/// <summary>
/// Page_Load
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
int id = int.Parse(Request.QueryString["id"].ToString());
AnnouncementEntity ae = AnnouncementOperation.GetAM(int.Parse(Request.QueryString["id"].ToString()));
if (ae != null)
{
DataBase db = new DataBase();
DataSet sql = db.ExCommand(string.Format("SELECT tb_announcement.id, tb_announcement.uid, tb_announcement.amtitle, tb_announcement.essay, tb_announcement.uptime, tb_user.userName FROM tb_announcement INNER JOIN tb_user ON tb_announcement.uid = tb_user.id WHERE (tb_announcement.id ={0} ) ", id));
string User = sql.Tables[0].Rows[0]["userName"].ToString();
//在表单中显示数据
lb_Id.Text = ae.Id.ToString();
lb_amtitle.Text = ae.AmTitle;
lb_User.Text = User;
lb_UpTime.Text = ae.Time.ToString();
lb_essay.Text = ae.Essay;
}
}
}
示例14: GetAssNotes
/// <summary>
/// 用源代码ID获取注释信息
/// </summary>
/// <param name="cid">源码ID</param>
/// <returns>返回注释列表</returns>
public static List<NoteEntity> GetAssNotes(int cid)
{
DataBase db = new DataBase();
DataSet ds = db.ExCommand("select * from tb_note where cid =" + cid);
List<NoteEntity> assNotes = new List<NoteEntity>();
foreach (DataRow dr in ds.Tables[0].Rows)
{
NoteEntity ne = new NoteEntity();
ne.Agree = int.Parse(dr["agree"].ToString());
ne.Cid = int.Parse(dr["cid"].ToString());
ne.Context = dr["context"].ToString();
ne.Disagree = int.Parse(dr["disagree"].ToString());
ne.EndLine = int.Parse(dr["endline"].ToString());
ne.Id = int.Parse(dr["id"].ToString());
ne.NoteName = dr["noteName"].ToString();
ne.StartLine = int.Parse(dr["startline"].ToString());
ne.Uid = int.Parse(dr["uid"].ToString());
ne.UpTime = DateTime.Parse(dr["uptime"].ToString());
assNotes.Add(ne);
}
return assNotes;
}
示例15: Page_Load
/// <summary>
/// Page_Load
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
int id = int.Parse(Request.QueryString["id"].ToString());
NoteEntity ne = NoteOperation.GetNote(int.Parse(Request.QueryString["id"].ToString()));
if (ne != null)
{
DataBase db = new DataBase();
DataSet sql = db.ExCommand(string.Format("SELECT tb_note.id, tb_note.noteName, tb_note.upTime, tb_note.cid, tb_note.uid, tb_user.userName, tb_code.path FROM tb_user INNER JOIN tb_note ON tb_user.id = tb_note.uid INNER JOIN tb_code ON tb_note.cid = tb_code.id WHERE (tb_note.id ={0} ) ", id));
string User = sql.Tables[0].Rows[0]["userName"].ToString();
string Path = sql.Tables[0].Rows[0]["path"].ToString();
//在表单中显示数据
lb_NoteName.Text = ne.NoteName;
lb_Id.Text = ne.Id.ToString();
lb_Path.Text = Path;
lb_User.Text = User;
lb_UpTime.Text = ne.UpTime.ToString();
}
}
}