C常用增删改查源码
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
这个是添加的代码
using System;
using
using ;
using ;
using ;
using ;
using
using
namespace 学生成绩管理系统
{
public partial class studentluru : Form
{
uid=sa;pwd=sa;database=sc";
using (SqlConnection conn = new SqlConnection(connstr))
{
();
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(sqlsel, conn);
(ds, "coust");
DataTable dt = ["coust"];
();
return dt;
}
}
private void button1_Click(object sender, EventArgs e)
{
if == true)
{
string xuehao = ;
string sqlsel = "select * from studentinfo where sno='" + xuehao + "'";
= bangding(sqlsel);
}
else
{
string xingming = ;
string sqlsel = "select * from studentinfo where sname='" + xingming + "'"; = bangding(sqlsel);
}
}
private void radioButton1_CheckedChanged(object sender, EventArgs e) {
if == true)
{
= true;
= false;
}
else
{
= false;
= true;
}
}
private void checkstate(int pos)
{
if (pos == 0)
{
= false;
= false;
= true;
= true;
}
else
{
= true;
= true;
= true;
= true;
}
}
到首记录
checkstate;
}
uid=sa;pwd=sa;database=sc";
using (SqlConnection conn = new SqlConnection(connstr))
{
();
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(sqlsel, conn);
(ds, "coust");
DataTable dt = ["coust"];
();
return dt;
}
}
private void checkBox1_CheckedChanged(object sender, EventArgs e) {
if == true)
{ = 450; }
else
{ = 250; }
}
private void button1_Click(object sender, EventArgs e)
{
if ("你确定要删除该记录吗", "询问", , ==
{
int pos = uid=sa;pwd=sa;database=sc";
using (SqlConnection conn = new SqlConnection(connstr))
{
();
DataSet ds = new DataSet();
string sqlset = "select * from studentinfo";
elete();
(ds, "coust");
= "";
= "";
= "";
= "";
= "";
= "";
= "";
= "";
= "";
= bangding(sqlset);
("恭喜你已成功删除","温馨提示");
();
}
}
}
}
}
修改的代码:
using System;
using
using ;
using ;
using ;
using ;
using
using
namespace 学生成绩管理系统
{
public partial class studentxiugai : Form
{
string connstr = "server=.;uid=sa;pwd=sa;database=sc";
string per;
string sno;
CurrencyManager cmAmend;
public studentxiugai()
{
InitializeComponent();
}
public studentxiugai(string k,string s)
{
InitializeComponent();
per = k;
sno = s;
}
private void checkBox1_CheckedChanged(object sender, EventArgs e) {
if == true)
{ uid=sa;pwd=sa;database=sc";
using (SqlConnection conn = new SqlConnection(connstr))
{
();
DataSet ds = new DataSet();