【正文】
ang As New Dim sql As StringIf Trim() Trim() Then = Else userID amp。 sql, conn, adOpenKeyset, adLockPessimistic MsgBox 密碼修改成功, vbOKOnly + vbExclamation, (4) 庫(kù)房管理子窗體代碼 庫(kù)房管理子窗體是用來(lái)管理圖書資料的。就是在DataGrid的文本框中顯示圖書進(jìn)出的清單,最后把填寫的明細(xì)存儲(chǔ)到數(shù)據(jù)庫(kù)中。 39。 39。 39。 調(diào)用顯示Datagrid1子程序loaderror:If 0 Then If Not IsNull((0)) Then = (0) Else = 1 If Not IsNull((2)) Then = (2) Else = = 5 .ScrollBars = flexScrollBarBoth .SelectionMode = flexSelectionByRowFor i = 0 To .Rows 1 MsgBox End SubPrivate Sub Form_Unload(Cancel As Integer)findok = FalseEnd SubPrivate Sub MSFlexGrid1_Click()On Error GoTo griderrorDim getrow As Longgetrow = If = 1 Then MsgBox End IfEnd SubPublic Sub showdata()With MSFlexGrid2 .Rows = + 1 .Row = 0If Not Then Do While Not If Not IsNull((4)) And CDbl((4)) 0 Then End If If Not IsNull((5)) Then .Text = (5) Else .Text = If Not IsNull((6)) Then .Text = (6) Else .Text = Else 查詢子窗體運(yùn)行效果在列表框中給出編號(hào)或年月日后,“查詢”按鈕的Click事件將給出與數(shù)據(jù)庫(kù)查找比較的結(jié)果。 amp。 39。 amp。 find_date1 amp。 find_date2 amp。Dim i As IntegerDim sql As StringIf findok = True Then With rs_find Loop 添加年 添加月 添加日 查詢結(jié)果圖表 2。 Combod(1).AddItem iNext iEnd Sub查詢完畢后,輸出查詢結(jié)果,如圖742所示。 Combom(1).AddItem iNext iFor i = 1 To 31 Comboy(1).AddItem iNext iFor i = 1 To 12 End WithEnd IfFor i = 2001 To 2005 添加編號(hào) End Ifsql = select * from 圖書資料 order by 編號(hào) desc = adUseClient sql, conn, adOpenKeyset, adLockPessimisticIf = False Then and amp。 _ amp。 amp。 amp。 amp。 39。 and amp。其運(yùn)行效果如圖741所示。 If Not IsNull((8)) Then .Text = (8) Else .Text = End If If Not IsNull((7)) And CDbl((4)) 0 Then Else If Not IsNull((3)) Then .Text = (3) Else .Text = If Not IsNull((2)) Then .Text = (2) Else .Text = If Not IsNull((1)) Then .Text = (1) Else .Text = If Not IsNull((0)) Then .Text = (0) Else .Text = .Col = 0 MsgBox 無(wú)相關(guān)記錄, vbOKOnly + vbExclamation, Elseselect_row = (getrow, 0)End Ifgriderror:If 0 Then MsgBox End SubPublic Sub setgridhead()On Error GoTo setheaderror = 0 = 0 = 編號(hào) = 1 = 購(gòu)買日期 = 2 = 書名 = 3 = 類型 = 4 = 定價(jià) = 5 = 備注Exit Subsetheaderror: .ColWidth(i) = 1300Next iEnd WithExit Subseterror: .Rows = + 1 = If Not IsNull((4)) Then = (4) Else = 3 = = + 1 MsgBox End IfEnd Sub39。 (0)圖740 Unload MeEnd If圖表 1End Sub在上述代碼中,首先比較兩個(gè)表中的數(shù)據(jù)是否一致,(1) = 。 (1) = sql = select * from 系統(tǒng)管理 where 用戶名=39。 = MsgBox 密碼不一致!, vbOKOnly + vbExclamation, 其運(yùn)行效果如圖738所示。 Unload Me (1) = Exit Sub = MsgBox 兩次密碼不一致, vbOKOnly + vbEx