本文整理汇总了C#中SqlHelper.RunSql方法的典型用法代码示例。如果您正苦于以下问题:C# SqlHelper.RunSql方法的具体用法?C# SqlHelper.RunSql怎么用?C# SqlHelper.RunSql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SqlHelper
的用法示例。
在下文中一共展示了SqlHelper.RunSql方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GridView1_RowUpdating
//GridView控件RowUpdating事件
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
SqlHelper mydata = new SqlHelper();
string ID = GridView1.DataKeys[e.RowIndex].Values[0].ToString();
try
{
mydata.RunSql("update Musictype set name='" + ((TextBox)GridView1.Rows[e.RowIndex].FindControl("txtName")).Text + "' where id=" + ID);
Response.Write("<script language=javascript>alert('修改成功!')</script>");
GridView1.EditIndex = -1;
InitData();
}
catch
{
Response.Write("<script language=javascript>alert('修改失败!')</script>");
}
}
示例2: UPpwd
/// 修改密码
/// </summary>
private void UPpwd()
{
SqlHelper mydata = new SqlHelper();
string Username = Session["Admin"].ToString();
try
{
string sql = "update [Admin] set [Apwd] ='" + txtpwd2.Text.ToString() + "' where [Aname]='" + Username + "' ";
mydata.RunSql(sql);
LabelWarningMessage.Text = "修改成功!";
}
catch
{
LabelWarningMessage.Text = "修改失败!";
}
}
示例3: GridView1_RowDeleting
//GridView控件RowDeleting事件
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
SqlHelper mydata = new SqlHelper();
string ID = GridView1.DataKeys[e.RowIndex].Values[0].ToString();
try
{
mydata.RunSql("delete from Musictype where id='" + ID + "'");
Response.Write("<script language=javascript>alert('成功删除!')</script>");
GridView1.EditIndex = -1;
InitData();
}
catch
{
Response.Write("<script language=javascript>alert('删除失败!')</script>");
}
}
示例4: gvFilms_RowDeleting
protected void gvFilms_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
SqlHelper mydata = new SqlHelper();
string ID = gvFilms.DataKeys[e.RowIndex].Values[0].ToString();
try
{
mydata.RunSql("delete from News where id='" + ID + "'");
Label4.Text = "删除成功!";
gvFilms.EditIndex = -1;
Get_Article();
}
catch
{
Label4.Text = "删除失败!";
}
}