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


C# SqlDataSource.Delete方法代码示例

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


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

示例1: Button1_Click

    protected void Button1_Click(object sender, EventArgs e)
    {
        SqlDataSource SqlDataSource2 = new SqlDataSource();
        SqlDataSource2.ConnectionString = WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
        try
        {
            SqlDataSource2.DeleteCommand = "delete [Account_Order_M] where id=" + Request["Id"];

            int affraw = SqlDataSource2.Delete();
            if (affraw == 0)
            {
                Label8.Text = "error";
                Button1.Visible = false;
            }
            else
            {
                Label8.Text = "ok";
                Button1.Visible = false;
            }
        }
        catch (Exception ex2)
        {
            Response.Write(ex2.ToString());
        }
        finally
        {
            SqlDataSource2.Dispose();
        }
    }
开发者ID:keithliang,项目名称:PersonalProducts_Account,代码行数:29,代码来源:UpdateJournalDelate.aspx.cs

示例2: delete_seat

 protected void delete_seat(String Route_has_Bus_ID)
 {
     SqlDataSource seat = new SqlDataSource();
        seat.ConnectionString =
        ConfigurationManager.ConnectionStrings["BusTicketConnectionString1"].ToString();
        seat.DeleteCommand = "DELETE FROM [Seat] WHERE Route_has_Bus_ID = " + Route_has_Bus_ID;
        seat.Delete();
 }
开发者ID:chagridsada,项目名称:BusTicket-Online,代码行数:8,代码来源:Route_has_Bus.aspx.cs

示例3: Button1_Click

    protected void Button1_Click(object sender, EventArgs e)
    {
        SqlDataSource SqlDataSource2 = new SqlDataSource();
        SqlDataSource2.ConnectionString=WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
        try
        {
            //update
            //SqlDataSource2.UpdateParameters.Add("Order_date", TextBox1.Text);
            //SqlDataSource2.UpdateParameters.Add("Assign_numbers", TextBox2.Text);
            //SqlDataSource2.UpdateParameters.Add("Account_numbers", DropDownList1.Text);
            //SqlDataSource2.UpdateParameters.Add("Account_abstract", TextBox3.Text);
            //SqlDataSource2.UpdateParameters.Add("Income", TextBox4.Text);
            //SqlDataSource2.UpdateParameters.Add("Spend", TextBox5.Text);
            //SqlDataSource2.UpdateCommand = "Update [Joural_Order_M] set [email protected]_date, [email protected]_numbers, [email protected]_numbers, [email protected]_abstract, [email protected], [email protected] where Id=" + Request["Id"];
            //update

            SqlDataSource2.DeleteCommand = "delete [Account_Order_M]  where Id=" + Request["Id"];

            //delete table Joural_Order_M content
            //SqlDataSource2.DeleteParameters.Add("Order_date", Label1.Text);
            //SqlDataSource2.DeleteParameters.Add("Assign_numbers", Label2.Text);
            //SqlDataSource2.DeleteParameters.Add("Account_numbers", Label3.Text);
            //SqlDataSource2.DeleteParameters.Add("Account_abstract", TextBox3.Text);
            //SqlDataSource2.DeleteParameters.Add("Income", TextBox4.Text);
            //SqlDataSource2.DeleteParameters.Add("Spend", TextBox5.Text);
            //delete table Joural_Order_M content

            int affraw = SqlDataSource2.Delete();

            if (affraw == 0)
            {
                Label1.Text = "Error";
            }
            else
            {
                Label1.Text = "Delete OK";
                Button1.Visible = false;
            }
        }
        catch (Exception ex2)
        {
            Response.Write("error" + ex2.ToString());
        }
        finally
        {
            SqlDataSource2.Dispose();
        }
    }
开发者ID:keithliang,项目名称:PersonalProducts_Account,代码行数:48,代码来源:DeleteEdit.aspx.cs


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