If Not Testtxt(txtUserID.Text) Then MsgBox "请输入用户名!", vbOKOnly +vbExclamation, "警告" txtUserID.SetFocus Exit Sub End If
例1:
txtSQL = "select * from User_Info whereLevel='" & Trim(ComboHead.Text) & "'" set mrc=ExecuteSQL(txtSQL,MsgText) mrc.addnew
例2:
txtSQL = "insert into checkday_Info values('" & ReMainCash & "','" &ReChargeCash & "','" & ConsumeCash & "','"& Cancel Cash & "','" & AllCash & "','" &Mydate & "')" Set mrc = ExecuteSQL(txtSQL, MsgText)
例1:
txtSQL = "delete from User_Info where UserID='" & Trim(DelUser) & "'" Set mrc = ExecuteSQL(DelSQL, MsgText)
例1:
txtSQL = "select * from User_Info whereLevel='" & Trim(ComboHead.Text) & "'" set mrc=ExecuteSQL(txtSQL,MsgText) mrc.addnew
例2:
txtSQL="update student_Info set cash="& Balance &" where cardno='"& Trim(cardno) &"'" set mrc=ExecuteSQL(txtSQL,MsgText)
txtSQL= "select * from CancelCard_Info where Date between '" &CStr(DTPicker1.Value) & "' and'" & CStr(DTPicker2.Value)& "'"
txtSQL= "select Count(*) from OnLine_Info"
txtSQL= "select sum(addmoney) from Recharge_Info where UserID='" &Trim(cmbOperatorName) & "'and status='未结账'"
With myflexgrid .Font = "微软雅黑" .Font.Size = "16" .Rows = 1 .CellAlignment = 4 .TextMatrix(0, 0) = "卡号" .TextMatrix(0, 1) = "充值金额" .TextMatrix(0, 2) = "充值日期" .TextMatrix(0, 3) = "充值时间" .TextMatrix(0, 4) = "充值教师" .TextMatrix(0, 5) = "结账状态" While mrc.EOF = False .Rows = .Rows + 1 .CellAlignment = 4 .TextMatrix(.Rows - 1, 0) = mrc.Fields(2) .TextMatrix(.Rows - 1, 1) = mrc.Fields(3) .TextMatrix(.Rows - 1, 2) = mrc.Fields(4) .TextMatrix(.Rows - 1, 3) = mrc.Fields(5) .TextMatrix(.Rows - 1, 4) = mrc.Fields(6) .TextMatrix(.Rows - 1, 5) = mrc.Fields(7) mrc.MoveNext Wend
Dim i As Integer Dim j As Integer '如果有错误就统一处理,提示没有数据导出 On Error Resume Next If myflexGrid.TextMatrix(1, 0) = "" Then MsgBox "没有数据导出", vbInformation, "提示" Exit Sub End If Dim excelApp As Excel.Application Set excelApp = New Excel.Application Set excelApp = CreateObject("Excel.application")'创建excel对象 Dim exbooks As Excel.Workbook Dim exsheet As Excel.Worksheet Set exbook = excelApp.Workbooks.Add'添加新工作簿 excelApp.SheetsInNewWorkbook = 1 excelApp.Visible = True With excelApp.ActiveSheet'创建excel工作簿中的行和列 For i = 1 To myflexGrid.Rows For j = 1 To myflexGrid.Cols .Cells(i, j).Value = "" & Format$(myflexGrid.TextMatrix(i - 1, j - 1)) Next j Next i End With Set exsheet = Nothing Set exbook = Nothing Set excelApp = Nothing