VB电表管理信息系统 第10页

VB电表管理信息系统 第10页
8. 数据修改界面设计:
数据修改代码设计:
Dim changeE As Double
 Dim cEcount As Double

Private Sub cmdAsure_Click()
    If Trim(MDIme.dcvalue.BoundText) <> "" Then
        Dim cnn As New ADODB.Connection
        Dim sqlAdd As String
        cnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:database password= " & DbPassword & " ;Data Source= " & _
        App.Path & "\data\dbdb.mdb;Persist Security Info=False"
        cnn.CursorLocation = adUseClient
        cnn.Open
        sqlAdd = "update  panelinfo  set holderid='" & txtUserName(0) & "',holder='" & txtUserName(1) & "',LEndPCode='" & txtUserName(2) & "',CopyDate=# " & dtpWdate.Value & "# ,lightscale=" & txtUserName(3) & ",lsfee=" & txtUserName(4) & ",lmoney=" & txtUserName(5) & ",bmoney=" & txtUserName(6) & ",cname='" & txtUserName(7) & "',memotext='" & txtUserName(8) & "',cEndCode=" & txtUserName(9) & ",cFeeMoney=" & Val(txtUserName(10)) & " ,nowecount=" & changeE & ",atimes=" & Me.Text1 & ""
        sqlAdd = sqlAdd & " where holderid='" & Trim(MDIme.dcvalue.BoundText) & "'"
      
        cnn.Execute sqlAdd
        sqlAdd = "update 用户类型 set  UNITPRICE=" & Me.txtUserName(5) & " where ATypeID=" & dcob用途.BoundText
        cnn.Close
        MsgBox " 数据修改完成! ", vbInformation
    End If
   
End Sub

Private Sub Command1_Click()
Unload Me
 
End Sub

Private Sub dcob用途_Click(Area As Integer)
Dim rst As New ADODB.Recordset
If dcob用途.BoundText <> "" Then
rst.Open "select * from 用户类型 where ATypeID=" & dcob用途.BoundText & "", gCnn, adOpenStatic, adLockBatchOptimistic
Me.txtUserName(5) = Format(rst.Fields(2), "###0.00")
rst.Close
Else
  MsgBox " 请先添加用户电表类型信息! ", vbInformation
  Exit Sub
End If
End Sub

Private Sub Form_Load()
Dim rst As New ADODB.Recordset
Dim sqlEdit As String
sqlEdit = "select * from panelinfo "
sqlEdit = sqlEdit & " where holderid='" & Trim(MDIme.txtUserName(0)) & "' and delflag<>true "
rst.Open sqlEdit, gCnn, adOpenKeyset, adLockBatchOptimistic
If Not rst.EOF Then

    txtUserName(0) = rst.Fields(1)
    txtUserName(1) = rst.Fields(2)
    txtUserName(2) = rst.Fields(3)
    dtpWdate.Value = rst.Fields(4)
    txtUserName(3) = Format(rst.Fields(5), "####0.00")
    txtUserName(4) = Format(rst.Fields(6), "####0.00")
    txtUserName(5) = Format(rst.Fields(7), "####0.00")
    txtUserName(6) = Format(rst.Fields(8), "####0.00")
    txtUserName(7) = rst.Fields(9)
    txtUserName(8) = rst.Fields(10)
    txtUserName(9) = rst.Fields!cendcode
    Text1.Text = rst.Fields!Atimes
    changeE = rst.Fields!cendcode
    cEcount = rst.Fields!nowecount
   
    If rst.Fields(14) <> Null Then
        DTPicker1.Value = rst.Fields(14)
    End If
    txtUserName(10) = rst.Fields!cFeeMoney   
End If
Dim rstJB As New ADODB.Recordset
Set rstJB.ActiveConnection = gCnn
rstJB.CursorLocation = adUseClient
rstJB.LockType = adLockBatchOptimistic
rstJB.CursorType = adOpenKeyset
rstJB.Open "select * from  用户类型 where atypeid=" & rst.Fields!AtypeID
Set dcob用途.DataSource = rstJB
Set dcob用途.RowSource = rstJB
dcob用途.BoundColumn = "ATYPEID"
dcob用途.ListField = "ATYPE"
If rstJB.RecordCount <> 0 Then
    dcob用途.Text = rstJB.Fields(1)
    Me.txtUserName(5) = Format(rstJB.Fields(2), "###0.00")
End If
rst.Close
End Sub
Private Sub Form_Unload(Cancel As Integer)
MDIme.loadData (txtUserName(0))
End Sub
Private Sub txtUserName_Change(Index As Integer)
If Index = 9 Then
   changeE = cEcount + (Val(txtUserName(9)) - changeE)
End If
End Sub
Private Sub UpDown1_Change()
Me.Text1 = UpDown1.Value
End Sub
9. 开始收费界面设计:
开始收费代码设计:
Private Sub CmdPrint_Click()
On Error GoTo l
Dim LongColor As Long
If MsgBox("打印机准备好了吗?", vbYesNo + vbInformation) <> vbYes Then
  Exit Sub
End If
Me.CmdPrint.Visible = False
LongColor = Me.BackColor

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  ... 下一页  >> 

Copyright © 2007-2012 www.chuibin.com 六维论文网 版权所有