资源描述:
《C#常用增删改查源码.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、.....................最新资料整理推荐.....................这个是添加的代码usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Text;usingSystem.Windows.Forms;usingSystem.Data.SqlClient;namespace学生成绩管理系统{p
2、ublicpartialclassstudentluru:Form{//CurrencyManagercmAmend;//SqlConnectionsqlConnection1=newSqlConnection();publicstudentluru(){InitializeComponent();}27.....................最新资料整理推荐.....................privatevoidstudentluru_Load(objectsender,EventArgse)
3、{}//录入privatevoidbutton5_Click(objectsender,EventArgse){stringsno=textBox1.Text;stringsname=textBox2.Text;stringssex=textBox3.Text;stringsage=textBox4.Text;stringsclass=textBox5.Text;stringsdept=textBox6.Text;stringsaddress=textBox7.Text;stringsphone=text
4、Box8.Text;stringsqq=textBox9.Text;if(textBox1.Text==""
5、
6、textBox2.Text==""
7、
8、textBox5.Text==""){if(textBox1.Text=="")27.....................最新资料整理推荐.....................{MessageBox.Show("学号不能为空","警告提示",MessageBoxButtons.OKCancel,MessageBoxIcon.Error);textBo
9、x1.Focus();return;}if(textBox2.Text==""){MessageBox.Show("姓名不能为空","警告提示",MessageBoxButtons.OKCancel,MessageBoxIcon.Error);textBox2.Focus();return;}if(textBox5.Text==""){MessageBox.Show("班级不能为空","警告提示",MessageBoxButtons.OKCancel,MessageBoxIcon.Error);27...
10、..................最新资料整理推荐.....................textBox5.Focus();return;}}else{stringconnstr="server=IT32;uid=sa;pwd='sa';database=sc;";try{SqlConnectionconn=newSqlConnection(connstr);conn.Open();stringsqlinsert="insertintostudentinfovalues('"+sno+"','"+sn
11、ame+"','"+ssex+"','"+sage+"','"+sclass+"','"+sdept+"','"+saddress+"','"+sphone+"','"+sqq+"')";SqlCommandsc=newSqlCommand(sqlinsert,conn);sc.ExecuteNonQuery();textBox1.Text="";textBox2.Text="";textBox3.Text="";27.....................最新资料整理推荐...............
12、......textBox4.Text="";textBox5.Text="";textBox6.Text="";textBox7.Text="";textBox8.Text="";textBox9.Text="";MessageBox.Show("数据已经添加成功","温馨提示");conn.Close();}catch(Exceptionex){MessageBox.Show(ex.ToString());}}}27...