VB与SQL2005的一些操作

Private Sub AddInfra()

    With Adodc1

   .RecordSource = "select * from t_Infra_red"
            .Recordset.AddNew
            .Recordset.Fields("Device_id") = 2
           .Recordset.Fields("Dtime") = Date + Time
            .Recordset.Fields("Infra") = infra

           .Recordset.Update
   End With

End Sub
Private Sub AddAlc()


    With Adodc2

    .RecordSource = "select * from t_Alcohol"
            .Recordset.AddNew
            .Recordset.Fields("Device_id") = 3
            .Recordset.Fields("Dtime") = Date + Time
            .Recordset.Fields("Alcohol") = alc

            .Recordset.Update
    End With

End Sub
Private Sub AddPho()
    With Adodc3

    .RecordSource = "select * from t_Photosensitive"
            .Recordset.AddNew
           .Recordset.Fields("Device_id") = 4
           .Recordset.Fields("Dtime") = Date + Time
           .Recordset.Fields("Photosensitive") = pho

            .Recordset.Update
    End With

End Sub

Private Sub AddTH()
    With Adodc4

    .RecordSource = "select * from t_TemHum"
            .Recordset.AddNew
            .Recordset.Fields("Device_id") = 5
            .Recordset.Fields("Dtime") = Date + Time
            .Recordset.Fields("Temperature") = tem
            .Recordset.Fields("Humidity") = hum
            .Recordset.Update
    End With

End Sub
Private Sub AddUlt()


    With Adodc5

    .RecordSource = "select * from t_Ultrasonic_wave"
            .Recordset.AddNew
           .Recordset.Fields("Device_id") = 6
            .Recordset.Fields("Dtime") = Date + Time
           .Recordset.Fields("Ultrasonic") = ult

            .Recordset.Update
   End With

End Sub

 If infra <> "" Then
        Call Picture2_Click
    ElseIf alc <> "" Then
        Call Picture3_Click
    ElseIf pho <> "" Then
        Call Picture4_Click
    ElseIf th <> "" Then
        Call Picture5_Click
    ElseIf ult <> "" Then
        Call Picture6_Click
    End If

你可能感兴趣的:(vb,sql2005)