本文整理汇总了C#中SqlDataSource.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# SqlDataSource.Dispose方法的具体用法?C# SqlDataSource.Dispose怎么用?C# SqlDataSource.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SqlDataSource
的用法示例。
在下文中一共展示了SqlDataSource.Dispose方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Button1_Click
protected void Button1_Click(object sender, EventArgs e)
{
SqlDataSource sqldatasource2 = new SqlDataSource();
sqldatasource2.ConnectionString = WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString.ToString();
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 [Account_Order_M] set [email protected]_date, [email protected]_numbers, [email protected]_numbers, [email protected]_abstract, [email protected], [email protected] where Id="+Request["Id"];
int affraw_update = sqldatasource2.Update();
if (affraw_update == 0)
{
Label1.Text = "error";
}
else
{
Label1.Text = "ok";
Button1.Visible = false;
}
sqldatasource2.Dispose();
}
示例2: 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();
}
}
示例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();
}
}
示例4: Button1_Click
protected void Button1_Click(object sender, EventArgs e)
{
SqlDataSource sqldatasource2 = new SqlDataSource();
sqldatasource2.ConnectionString = WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString.ToString();
sqldatasource2.UpdateParameters.Add("Lottery", DropDownList1.Text);
sqldatasource2.UpdateCommand = "Update [Account_Order_M] set [email protected] where Id=" + Request["Id"];
int affraw_update = sqldatasource2.Update();
if (affraw_update == 0)
{
Label8.Text = "error";
}
else
{
Label8.Text = "ok";
Button1.Visible = false;
}
sqldatasource2.Dispose();
}
示例5: Button1_Click
protected void Button1_Click(object sender, EventArgs e)
{
SqlDataSource SqlDataSource1 = new SqlDataSource();
SqlDataSource1.ConnectionString = WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
SqlDataSource1.InsertParameters.Add("Order_date", TextBox1.Text);
SqlDataSource1.InsertParameters.Add("Assign_numbers", TextBox2.Text);
SqlDataSource1.InsertParameters.Add("Account_numbers", DropDownList1.Text);
SqlDataSource1.InsertParameters.Add("Account_abstract", TextBox3.Text);
SqlDataSource1.InsertParameters.Add("Income", TextBox4.Text);
SqlDataSource1.InsertParameters.Add("Spend", TextBox5.Text);
SqlDataSource1.InsertCommand = "Insert into Account_Order_M(Order_date,Assign_numbers,Account_numbers,Account_abstract,Income,Spend) values(@Order_date,@Assign_numbers,@Account_numbers,@Account_abstract,@Income,@Spend)";
int affraw = SqlDataSource1.Insert();
if (affraw == 0)
{
Label1.Text = "Error";
}
else
{
Label1.Text = "OK";
Button1.Visible = false;
}
SqlDataSource1.Dispose();
}