Computer room charging system summary 1

1. Write new data to the table

txtSQL = "select*from table name in database "

        Set mrcc = ExecuteSQL(txtSQL, msgtext)

        mrcc.AddNew  reinserts data

        mrcc.Fields(1) = data to enter

        。。。

        mrcc.Update  updates the database

2. Change a specified data of a specified row

      txtSQL = "select*from the table name in the database where a row name = '" & Text1.Text (input box content, mainly to determine whether it is the same as the data) & "'"

     Set mrc = ExecuteSQL(txtSQL, msgtext)

     mrc.Fields(7) (a column in the data table, the code above determines the row, this code determines the column) = the specific data to be updated   

     mrc.Update  update data table

3. Query a row of data and display it in the label

txtSQL = "select*from student_Info"

       Set mrc = ExecuteSQL(txtSQL, msgtext)

       While (mrc.EOF = False)

          If Trim(mrc.Fields(0)) = Trim(Text1.Text) Then

               Label3.Caption = " Top- up card number :" & mrc.Fields(0) & Chr(13) & Chr(13) & " Top- up amount: " & i & Chr(13) & Chr(13) & " Student number: " & mrc.Fields(1) & Chr(13) & Chr(13) & " Name: " & mrc.Fields(2) & Chr(13) & Chr(13) & " Recharge Date: " & Date & Chr( 13) & Chr(13) & " Recharge Time :" & Time & Chr(13) & Chr(13) & " Operator :" & username

               Exit Sub

               Else

               mrc.MoveNext

           End If

      Wend

 

 

Five, query the data of a row in the database

      ' Create a link to the database

        txtSQL = "select*from cabcelcard_info "

        Set mrcc = ExecuteSQL(txtSQL, msgtext)

        ' Determine whether the card has been returned

        While (mrcc.EOF = False)

           If Trim(mrcc.Fields(1)) = Trim(Text1.Text) Then

            MsgBox " This card has been returned! ", vbOKOnly +vbExclamation, " Warning "

              Exit Sub

               Else

              mrcc.MoveNext

           End If

        Wend

。。。。。。。。。。。。。。。

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325991198&siteId=291194637