“修改”
按钮的程序 \x0d\x0aPrivate Sub cmdEdit_Click() \x0d\x0asql = "select * from 停时统计 where date = cdate('" &Text8.Text &"') and ycqk = '" &Combo1.Text &"'and id = '" &DataGrid1.Columns(2).CellText(DataGrid1.Bookmark) &"'" \x0d\x0ars.Open sql, dm, adOpenDynamic, adLockOptimistic \x0d\x0ars.Fields("id") = Text7.Text \x0d\x0ars.Fields("ycqk") = Combo1.Text \x0d\x0ars.Fields("date1") = Text1.Text \x0d\x0ars.Fields("time1") = Text2.Text \x0d\x0ars.Fields("date2") = Text3.Text \x0d\x0ars.Fields("time2") = Text4.Text \x0d\x0ars.Update \x0d\x0ars.Close \x0d\x0aEnd Sub \x0d\x0a\x0d\x0a'“删除”按钮的程序 \x0d\x0aPrivate Sub cmdDelete_Click() \x0d\x0astrFCode = DataGrid1.Columns(0).CellText(DataGrid1.Bookmark) \x0d\x0astrSCode = DataGrid1.Columns(2).CellText(DataGrid1.Bookmark) \x0d\x0astrCCode = DataGrid1.Columns(1).CellText(DataGrid1.Bookmark) \x0d\x0asql = "select * from 停时统计 where date='" &strFCode &"' and id='" &strSCode &"' and ycqk='" &strCCode &"'" \x0d\x0ars.Open sql, dm, adOpenDynamic, adLockOptimistic \x0d\x0ars.Delete \x0d\x0ars.Update \x0d\x0ars.Close \x0d\x0aEnd Sub \x0d\x0a\x0d\x0a'“增加”按钮的程序 \x0d\x0aPrivate Sub Command1_Click() \x0d\x0asql = "select * from 停时统计 order by id" \x0d\x0ars.Open sql, dm, adOpenDynamic, adLockOptimistic \x0d\x0ars.AddNew \x0d\x0ars.Fields("date") = Date \x0d\x0ars.Fields("id") = Text7.Text - 1 \x0d\x0ars.Fields("ycqk") = Combo1.Text \x0d\x0ars.Fields("date1") = Text1.Text \x0d\x0ars.Fields("time1") = Text2.Text \x0d\x0ars.Fields("date2") = Text3.Text \x0d\x0ars.Fields("time2") = Text4.Text \x0d\x0ars.Update \x0d\x0ars.Close \x0d\x0a\x0d\x0aWith Adodc1 \x0d\x0aAdodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0Data Source=" &App.Path &"\db1.mdbPersist Security Info=False" \x0d\x0aAdodc1.RecordSource = "select * from 停时统计 where date = cdate('" &Text8.Text &"') and ycqk = '" &Combo1.Text &"' order by id" \x0d\x0aAdodc1.Refresh \x0d\x0aDataGrid1.Refresh \x0d\x0aEnd With \x0d\x0aEnd Subpublic
bool
Del_delive(int
id)
{
DataSet
ds
=
new
DataSet()
bool
Isadd
=
false
string
sql
=
"Del_Delivetime"
Conn
con
=
new
Conn()
SqlConnection
conn
=
con.Getcon()
SqlCommand
comm
=
new
SqlCommand(sql,
conn)
comm.CommandType
=
CommandType.StoredProcedure
comm.Parameters.Add(new
SqlParameter("@id",
SqlDbType.Int,
4))
comm.Parameters["@id"].Value
=
id
try
{
comm.ExecuteNonQuery()
Isadd
=
true
}
catch
{
Isadd
=
false
}
return
Isadd
}
这个是存储过程。
update
表明
SET
字段名=‘要修改的数值’
where
id=''
Dim str As StringIf Text23.Text = "" Then
MsgBox "密码不能为空!", vbInformation + vbOKOnly, "提示您"
Exit Sub
End IfIf Text23.Text <>Text24.Text Then
MsgBox "两次输入的密码不一致!", vbInformation + vbOKOnly, "提示您"
Exit Sub
End Ifstr = "update 登录表 set 密码='" &Text23.Text &"' where 用户='" &Text21.Text &"'" If executesql(str) = True Then
MsgBox "密码已经修改!", vbInformation + vbOKOnly, "提示您"
Text23.Text = ""
Text24.Text = ""
Else
MsgBox "修改密码失败,有问题请联系管理员!", vbInformation + vbOKOnly, "提示您"
End If
评论列表(0条)