通州好吃的火锅店:急求助!VB高手请进!

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/05 09:53:18
我的QQ:44621606,请注明VB即可,做毕设,很多问题~~~~~~急死了~~~在线等~~

请建立ACCESS数据库和你所需的表,数据库名CAR.MDB,按你要求数据表(应有4字段车牌号、车型、制造商、时间)表名jishijilu ,储存在于工程文件所在目录夹.此段代码时钟孔件不需要.
下面是主要代码,使用ADO数据控件.

Private Sub Command1_Click()
Adodc1.Recordset.AddNew
Adodc1.Recordset(0) = Text1.Text
Adodc1.Recordset(1) = Text2.Text
Adodc1.Recordset(2) = Text3.Text
Adodc1.Recordset(3) = Date$ & Time$
Adodc1.Recordset.Update
Command1.Enabled = False
End Sub

Private Sub Form_Load()
Text1 = "": Text2 = "": Text3 = ""
With Adodc1
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\car.mdb;Persist Security Info=False"
Adodc1.RecordSource = "select * form jishijilu"
End With
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub

Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text3.SetFocus
End If
End Sub

Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1.Enabled = True
Command1.SetFocus
End If
End Sub

连接打印机不要控件,可使用代码实现打印,见:
http://zhidao.baidu.com/question/4168806.html
时钟控件用法见:
http://zhidao.baidu.com/question/3734182.html
祝成功!