您的位置:首页 > 数据库

机房收费系统之修改

2015-08-05 20:00 351 查看
**最基本的对数据库进行的修改操作,给大家来个最简单的,看图:
就拿“修改基本数据”来说:
![这就是我机房的修改基本数据窗体](https://img-blog.csdn.net/20150805195314095)
下边是代码:


Option Explicit
Const xStr As String = "0123456789"
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then cmdok_Click
End Sub
Private Sub form_load()
'将basicdata中的数据显示到该界面上
Txtsql = "select * from basicdata_info"
Set mrc = ExecuteSQl(Txtsql, msgTxt)

Text1.Text = mrc.Fields(0)
Text2.Text = mrc.Fields(1)
Text3.Text = mrc.Fields(2)
Text4.Text = mrc.Fields(3)
Text5.Text = mrc.Fields(4)
Text6.Text = mrc.Fields(5)

Me.KeyPreview = True

End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
'只能输入数字
KeyAscii = IIf(InStr(xStr & Chr(8), Chr(KeyAscii)), KeyAscii, 0)
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
'只能输入数字
KeyAscii = IIf(InStr(xStr & Chr(8), Chr(KeyAscii)), KeyAscii, 0)
End Sub
'
'Private Sub Text3_KeyPress(KeyAscii As Integer)
''只能输入数字
'    KeyAscii = IIf(InStr(xStr & Chr(8), Chr(KeyAscii)), KeyAscii, 0)
'End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
'只能输入数字
KeyAscii = IIf(InStr(xStr & Chr(8), Chr(KeyAscii)), KeyAscii, 0)
End Sub
Private Sub Text5_KeyPress(KeyAscii As Integer)
'只能输入数字
KeyAscii = IIf(InStr(xStr & Chr(8), Chr(KeyAscii)), KeyAscii, 0)
End Sub
Private Sub Text6_KeyPress(KeyAscii As Integer)
'只能输入数字
KeyAscii = IIf(InStr(xStr & Chr(8), Chr(KeyAscii)), KeyAscii, 0)
End Sub
Private Sub command3_Click()
Unload Me
End Sub
Private Sub cmdok_Click()
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False

'将该界面上设定的信息赋值给basicdata表中

Txtsql = "select * from basicdata_info"
Set mrc = ExecuteSQl(Txtsql, msgTxt)
mrc.Fields(0) = Trim(Text1.Text)
mrc.Fields(1) = Trim(Text2.Text)
mrc.Fields(2) = Trim(Text3.Text)
mrc.Fields(3) = Trim(Text4.Text)
mrc.Fields(4) = Trim(Text5.Text)
mrc.Fields(5) = Trim(Text6.Text)
mrc.Fields(6) = UserName
mrc.Fields(7) = Date
mrc.Fields(8) = Time
mrc.Update
mrc.Close

MsgBox "基本数据设定成功!", vbOKOnly + vbExclamation, "提示"

End Sub
Private Sub cmdchange_Click()
Text1.Enabled = True
Text2.Enabled = True
Text4.Enabled = True
Text5.Enabled = True
Text6.Enabled = True
End Sub


以上代码就是我的机房收费系统的修改基本数据的全部代码,嘿嘿!**
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  数据库