Public Function InsertLog(_machineName As String) As Integer
Dim fmt As New dbFunction
Dim newID As Integer = -1
Dim constr As String = myconnectionstring
Using con As New MySqlConnection(constr)
Using cmd As New MySqlCommand("UpdateProgressLog_Insert", con)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.AddWithValue("@_startDateTime", DateTime.Now)
cmd.Parameters("@_startDateTime").Direction = ParameterDirection.Input
cmd.Parameters.AddWithValue("@_endDateTime", Nothing)
cmd.Parameters("@_endDateTime").Direction = ParameterDirection.Input
cmd.Parameters.AddWithValue("@_machinename", _machineName)
cmd.Parameters("@_machinename").Direction = ParameterDirection.Input
cmd.Parameters.AddWithValue("@_lastID", newID)
cmd.Parameters("@_lastID").Direction = ParameterDirection.Output
con.Open()
cmd.ExecuteNonQuery()
If IsDBNull(cmd.Parameters("@_lastID").Value) Then
newID = -1
Else
newID = fmt.ConvertdbToInteger(cmd.Parameters("@_lastID").Value)
End If
End Using
End Using
Return newID
End Function