问题描述
求高手帮忙补全修改和查询功能部分代码!!!!!!万分感谢!!!!!PrivateSubForm1_Load(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesMyBase.LoadDimstrSqlAsStringstrSql="select*fromtb_student"displayData(strSql)TextBox1.Text=""TextBox2.Text=""TextBox3.Text=""TextBox4.Text=""EndSub''''****将数据显示在datagrid控件中SubdisplayData(ByValstr1AsString)DimconnAsNewOleDbConnectionDimcommAsNewOleDbCommandDimstrSQLAsStringDimDSAsDataSetDimmyDataAdapter1AsNewOleDbDataAdapterDimstrConnAsStringstrConn="Provider=Microsoft.Jet.OLEDB.4.0;datasource=db1.MDB"conn.ConnectionString=strConnconn.Open()strSQL=str1'"select*fromtb_student"comm.Connection=conncomm.CommandType=CommandType.Textcomm.CommandText=strSQLmyDataAdapter1.SelectCommand=commDS=NewDataSetmyDataAdapter1.Fill(DS,"tb_student")DataGrid1.DataSource=DS.Tables(0)conn.Close()EndSub'''****添加功能PrivateSubButton1_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton1.ClickDimconnAsNewOleDbConnectionDimcommAsNewOleDbCommandDimstrsqlAsStringDimstrconnAsStringstrconn="Provider=Microsoft.Jet.OLEDB.4.0;datasource=db1.MDB"conn.ConnectionString=strconn'=NewOleDbConnection(strconn)conn.Open()strsql="insertintotb_student(studentno,studentname,age,address)values('"strsql=strsql&TextBox1.Text&"','"'insertintotb_student(studentno,studentname,age,address)values('20001000','www','2323','123')strsql=strsql&TextBox2.Text&"','"strsql=strsql&TextBox3.Text&"','"strsql=strsql&TextBox4.Text&"')"comm.Connection=conncomm.CommandType=CommandType.Textcomm.CommandText=strsqlcomm.ExecuteNonQuery()conn.Close()displayData("select*fromtb_student")EndSub''''***删除功能PrivateSubButton2_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton2.ClickDimstrsqlAsStringDimstr1AsStringDimconnAsNewOleDbConnectionDimcommAsNewOleDbCommandDimstrconnAsStringstrconn="Provider=Microsoft.Jet.OLEDB.4.0;datasource="&Application.StartupPath&"db1.MDB"conn=NewOleDbConnection(strconn)conn.Open()str1=TextBox1.Textstrsql="deletefromtb_studentwherestudentno='"&str1&"'"comm.Connection=conncomm.CommandType=CommandType.Textcomm.CommandText=strsqlcomm.ExecuteNonQuery()conn.Close()displayData("select*fromtb_student")EndSub''''***修改功能PrivateSubButton3_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton3.ClickEndSub'''''****查询功能PrivateSubButton4_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton4.ClickEndSub
解决方案
解决方案二:
知道添加和删除修改和查询不是一样么有什么不同吗?
解决方案三:
我也觉得奇怪,不是一样吗???
解决方案四:
我知道了,楼主就是一个脑细胞都不用的人,等现成的一复制就用的那种,很很很很那个的
解决方案五:
拉出去打板子..
解决方案六:
呵呵,哥们你就不要舍不得分啊,给点我吧