ADO.NET 删除数据
2021-06-30 15:04
标签:mic net where str 1.5 添加 adl exec database //这里记得添加命名空间 using System.Data.SqlClient; ADO.NET 删除数据 标签:mic net where str 1.5 添加 adl exec database 原文地址:http://www.cnblogs.com/wcl2017/p/7136406.htmlConsole.Write("请输入要删除的编号:");
string ucode = Console.ReadLine();
SqlConnection conn = new SqlConnection("server=.;database=Data0504;user=sa;pwd=123;");
SqlCommand cmd = conn.CreateCommand();
cmd.CommandText = "delete from Users where Ucode=‘" + ucode + "‘";
conn.Open();
int count = cmd.ExecuteNonQuery();
conn.Close();
if (count > 0)
{
Console.WriteLine("删除成功");
}
else
{
Console.WriteLine("删除失败!");
}
Console.ReadLine();
上一篇:The return type is incompatible with JspSourceDependent.getDependants():JasperException问题分析与解决方法
下一篇: PHP_Yield协程从入门到精通