'方法1:
Dim tmp1 As String
Dim pubConn As New ADODB.Connection
Dim DbaseName As String
Dim strSQL As String
DbaseName = App.Path + "\mdb\1.mdb"
'If sign = 0 Then
strSQL = "insert into ba (日期,B,A,C,D)
values( #" + Str$(Date + Time) + "#," + Val(n1) +
"," + Str$(n2) + " ," + Str$(n3) + " ," + Str$(n4) + ")"
'strSQL =
"insert into ba (日期,B,A,C) values( #" +
Str$(Time) + "#," + Text2.Text + "," + Text3.Text + " ," +
Text4.Text + " )"
'Else
' strSQL = "insert into ba
(日期,B,A,C) values( #" + Text5.Text + "#, " +
Text2.Text + " ," + Text3.Text + "," + "-" + Text4.Text + "
)"
'strSQL =
"insert into ba (T,B,A,C) values( " + Text5.Text
+ ", " + Text2.Text + " ," + Text3.Text + "," + "-" + Text4.Text +
" )"
'End If
'"
&Format(dpicker.value,
"yyyy-mm-dd")"
pubConn.ConnectionString = "driver={Microsoft Access Driver
(*.mdb)};dbq=" & _
"" & DbaseName & ";uid= ;pwd="
& "123 " & " "
pubConn.Open
pubConn.Execute strSQL
pubConn.Close
'方法2:
Dim DbaseName As String
Dim rs As New ADODB.Recordset
DbaseName = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
& App.Path & "\shoufei.mdb;Persist
Security Info = False"
Adodc1.ConnectionString = DbaseName
Adodc1.CommandType = adCmdText
Adodc2.ConnectionString = DbaseName
Adodc2.CommandType = adCmdText
Adodc1.RecordSource = "select * from chongzhi "
Adodc1.Refresh
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("日期") = Format(Now, "yyYY年mm月dd日
hh点mm分ss秒")
Adodc1.Recordset.Fields("卡号") = Text1(0).Text
Adodc1.Recordset.Fields("热用户名称") = Text1(1).Text
Adodc1.Recordset.Fields("卡上当前余额") = Label17.Caption
Adodc1.Recordset.Fields("当前上限") = Text1(4).Text
Adodc1.Recordset.Fields("当前帐户余额") = Text1(5).Text
Adodc1.Recordset.Fields("申请流量") = Text1(11).Text
Adodc1.Recordset.Fields("报警值") = Text1(12).Text
Adodc1.Recordset.Fields("备注") = Text2.Text
Adodc1.Recordset.Fields("实交金额") = Text1(7).Text
Adodc1.Recordset.Fields("用汽单价") = Text1(8).Text
Adodc1.Recordset.Fields("实充吨数") = Text1(10).Text
'Adodc1.Recordset.Fields("剩余金额") = Label30.Caption
Adodc1.Recordset.Fields("充后上限") = Label22.Caption
Adodc1.Recordset.Fields("充后帐户余额") = Label24.Caption
Adodc1.Recordset.Fields("充后卡上余额") = Label25.Caption
Adodc1.Recordset.Update
Adodc1.Refresh
Adodc1.RecordSource = "select * from chongzhi where 卡号 ='"
& Text1(0).Text & "' order by 日期
desc "
Adodc1.Refresh
Adodc1.Recordset.MoveFirst
Adodc1.Refresh
Call DataGrid_Ado1(Me)
分享
顶