本文整理汇总了C#中DataBase.ExCommandNoBack方法的典型用法代码示例。如果您正苦于以下问题:C# DataBase.ExCommandNoBack方法的具体用法?C# DataBase.ExCommandNoBack怎么用?C# DataBase.ExCommandNoBack使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataBase
的用法示例。
在下文中一共展示了DataBase.ExCommandNoBack方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddDing
/// <summary>
/// 添加顶操作
/// </summary>
/// <param name="de">顶的实例</param>
/// <returns>添加成功返回true 失败返回false</returns>
public static bool AddDing(DingEntity de)
{
DataBase db = new DataBase();
try
{
string sql = string.Format("INSERT INTO tb_Ding (nid,uid,isDing) VALUES ( '{0}', '{1}','{2}')", de.Nid, de.Uid, de.isDing);
db.ExCommandNoBack(sql);
DataSet rs = db.RunProcReturn("select * from tb_Ding where nid=" + de.Nid + "and uid=" + de.Uid, "tb_Ding");
int ID = int.Parse(rs.Tables[0].Rows[0]["id"].ToString());
if (rs.Tables[0].Rows.Count == 1)
{
return true;
}
else
{
string sql3 = "delete from dbo.tb_Ding where id=" + ID + "";
db.ExCommandNoBack(sql3);
return false;
}
}
catch
{
return false;
}
}
示例2: EditAnnouncement
public static void EditAnnouncement(int ID,String amtitle, String essay)
{
/*更新公告*/
DataBase db = new DataBase();
String sql = "UPDATE tb_announcement SET amtitle='" + amtitle + "',essay='" + essay + "' where id=" + ID.ToString();
db.ExCommandNoBack(sql);
}
示例3: DelAnnouncement
public static void DelAnnouncement(String id)
{
/*删除公告*/
DataBase db = new DataBase();
string sql = "delete from dbo.tb_announcement where id=" + id + "";
db.ExCommandNoBack(sql);
}
示例4: EditProject
public static void EditProject(string ProjectName, string description, int type,int ID)
{
/*工程的修改*/
DataBase db = new DataBase();
string sql = "UPDATE tb_project SET projectName ='" + ProjectName + "',description ='" + description + "',Tid = "+ type +" where id=" + ID.ToString();
db.ExCommandNoBack(sql);
}
示例5: DelNote
public static void DelNote(String id)
{
/*删除注释*/
DataBase db = new DataBase();
string sql = "delete from dbo.tb_note where id=" + id + "";
db.ExCommandNoBack(sql);
}
示例6: DelProject
public static void DelProject(String id)
{
/*删除工程*/
DataBase db = new DataBase();
string sql = "delete from dbo.tb_project where id=" + id + "";
db.ExCommandNoBack(sql);
}
示例7: btnEdit_Click
/// <summary>
/// 点击修改
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnEdit_Click(object sender, EventArgs e)
{
Validate();
if (!Page.IsValid)
{
//如果页面验证没通过则返回
return;
}
/*实例化一个数据库*/
DataBase db1 = new DataBase();
/*获取用户ID*/
string ID = Session["uid"].ToString();
string PassWord = tb_PassWord.Text;
String str = Encrypt.encrypt(PassWord);
string sql = "UPDATE tb_user SET password ='" + str + "' where id=" + ID.ToString();
try
{
db1.ExCommandNoBack(sql);
}
catch
{
/*修改成功,页面跳出提示*/
SmallScript.MessageBox(Page, "修改失败!");
return;
}
/*修改失败,页面跳出提示*/
SmallScript.MessageBox(Page, "修改密码成功。");
return;
}
示例8: btnEdit_Click
protected void btnEdit_Click(object sender, EventArgs e)
{
Validate();
if (!Page.IsValid)
{
SmallScript.MessageBox(Page, "修改失败!"); /*修改失败,页面跳出提示*/
/*如果页面验证没通过则返回*/
return;
}
else
{
DataBase db1 = new DataBase(); /*实例化一个数据库*/
string ID = Session["uid"].ToString(); /*获取用户ID*/
/*获取用户填写信息*/
bool Sex = (rb_Sex.SelectedIndex == 0);
string Email = tb_Email.Text;
string QQ = tb_QQ.Text;
/*执行数据库更新语句*/
/*将修改好的个人资料录入数据库*/
string sql = "UPDATE tb_user SET email ='" + Email + "', sex =" + (Sex ? 1 : 0).ToString() + ", qq ='" + QQ + "' where id=" + ID.ToString();
try
{
db1.ExCommandNoBack(sql);
}
catch
{
SmallScript.MessageBox(Page, "修改失败!"); /*修改失败,页面跳出提示*/
return;
}
SmallScript.MessageBox(Page, "修改用户成功。"); /*修改成功,页面跳出提示*/
return;
}
}
示例9: EditNote
public static void EditNote(string NoteName, int ID)
{
/*注释的修改*/
DataBase db = new DataBase();
string sql = "UPDATE tb_project SET projectName ='" + NoteName + "'where id=" + ID.ToString();
db.ExCommandNoBack(sql);
}
示例10: AddNote
/// <summary>
/// 添加注释
/// </summary>
/// <param name="ne">注释的实例</param>
/// <returns>添加成功返回true 失败返回false</returns>
public static bool AddNote(NoteEntity ne)
{
DataBase db = new DataBase();
try
{
string sql = string.Format("INSERT INTO tb_note ( noteName, uid, upTime, startLine, endLine, cid, agree, disagree,context )VALUES ( '{0}', '{1}','{2}', {3}, {4},{5},{6},{7},'{8}')", ne.NoteName, ne.Uid, ne.UpTime.ToString(), ne.StartLine, ne.EndLine, ne.Cid, ne.Agree, ne.Disagree, ne.Context.Trim().Replace(" ", ""));
db.ExCommandNoBack(sql);
return true;
}
catch
{
return false;
}
}
示例11: AddAnnouncement
/// <summary>
/// 添加公告
/// </summary>
/// <param name="ae">公告的实例</param>
/// <returns>添加成功返回true,添加失败返回 false</returns>
public static bool AddAnnouncement(AnnouncementEntity ae)
{
DataBase db = new DataBase();
try
{
string sql = string.Format("INSERT INTO tb_announcement (amtitle,essay,uid) VALUES ( '{0}', '{1}','{2}')", ae.AmTitle, ae.Essay,ae.Uid);
db.ExCommandNoBack(sql);
return true;
}
catch
{
return false;
}
}
示例12: AddComment
/// <summary>
/// 添加评论
/// </summary>
/// <param name="ce">评论的实例</param>
/// <returns>添加成功返回true,添加失败返回 false</returns>
public static bool AddComment(CommentEntity ce)
{
DataBase db = new DataBase();
try
{
string sql = string.Format("INSERT INTO tb_comment ( commentTitle, context, agree, disagree, uid, nid, uptime)VALUES ( '{0}', '{1}','{2}', '{3}', '{4}','{5}','{6}')", ce.CommentTitle, ce.ConText, ce.Agree, ce.DisAgree, ce.uid, ce.nid, ce.UpTime);
db.ExCommandNoBack(sql);
return true;
}
catch
{
return false;
}
}
示例13: AddProject
public static bool AddProject(ProjectEntity pe)
{
/*增加一个工程*/
DataBase db = new DataBase();
try
{
string sql =string.Format( "INSERT INTO tb_project ( projectName, description, upTime, tid, uid)VALUES ( '{0}', '{1}','{2}', {3}, {4})",pe.ProjectName,pe.Description,pe.UpTime,pe.Tid,pe.Uid);
db.ExCommandNoBack(sql);
return true;
}
catch
{
return false;
}
}
示例14: CancelRecommend
/// <summary>
/// 取消推荐操作
/// </summary>
/// <param name="noteId">注释的ID</param>
/// <returns></returns>
public static int CancelRecommend(int noteId)
{
DataBase db = new DataBase();
string sql = "select recommend from tb_note where id='" + noteId + "'";
string sql1 = "update tb_note set recommend='" + 0 + "' where id='" + noteId + "'";
DataSet ds = db.RunProcReturn(sql, "tb_note");
/*如果本就未被推荐,则返回0*/
if (int.Parse(ds.Tables[0].Rows[0]["recommend"].ToString()) == 0)
{
return 0;
}
/*如果已被推荐,则返回1*/
else
{
db.ExCommandNoBack(sql1);
return 1;
}
}
示例15: DelUser
/// <summary>
/// 删除用户
/// </summary>
/// <param name="id">用户ID</param>
public static void DelUser(String id)
{
DataBase db = new DataBase();
string sql = "delete from dbo.tb_user where id=" + id + "";
db.ExCommandNoBack(sql);
}