|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Senior Member
Iscritto dal: May 2002
Città: udine
Messaggi: 546
|
[VB.NET] System.Diagnostics.EventLog
ciao,
chi mi spiega qualcosa al riguardo? Non mi sono chiari alcuni concetti tipo quello di Log, di Source ecc. Prendendo questo semplice codice dal sito di msdn: Codice:
Module Module1
Sub Main()
Dim DS As System.Data.DataSet
Dim MyCommand As System.Data.OleDb.OleDbDataAdapter
Dim MyConnection As System.Data.OleDb.OleDbConnection
MyConnection = New System.Data.OleDb.OleDbConnection( _
"provider=Microsoft.Jet.OLEDB.4.0; " & _
"data source=C:\Documents eccetera\table.XLS; " & _
"Extended Properties=Excel 8.0;")
' Select the data from Sheet1 of the workbook.
MyCommand = New System.Data.OleDb.OleDbDataAdapter( _
"select * from [Sheet1$]", MyConnection)
DS = New System.Data.DataSet()
MyCommand.Fill(DS)
MyConnection.Close()
End Sub
End Module
Allora ho deciso di aggiungere un Codice:
Try
MyCommand.Fill(DS)
Catch e As System.Data.OleDb.OleDbException
Dim errorMessages As String
Dim i As Integer
Dim sSource As String
For i = 0 To e.Errors.Count - 1
errorMessages += "Index #" & i.ToString() & ControlChars.Cr _
& "Message: " & e.Errors(i).Message & ControlChars.Cr _
& "NativeError: " & e.Errors(i).NativeError & ControlChars.Cr _
& "Source: " & e.Errors(i).Source & ControlChars.Cr _
& "SQLState: " & e.Errors(i).SQLState & ControlChars.Cr
Next i
Dim log As System.Diagnostics.EventLog = New System.Diagnostics.EventLog()
log.Source = "Monte Carlo Optimization"
log.Log = "Applicazione"
log.MachineName = System.Environment.MachineName
System.Diagnostics.EventLog.CreateEventSource("Monte Carlo Optimization", "Applicazione")
log.WriteEntry(errorMessages)
Console.WriteLine("An exception occurred. Please contact your system administrator.")
Finally
MyConnection.Close()
End Try
Chi mi chiarisce?
__________________
a chi non piace il vino... dio neghi anche l'acqua! ![]() DELL Latitude E4300, iPhone 6 |
|
|
|
|
|
#2 |
|
Senior Member
Iscritto dal: May 2002
Città: udine
Messaggi: 546
|
scusate... questo è il file...
__________________
a chi non piace il vino... dio neghi anche l'acqua! ![]() DELL Latitude E4300, iPhone 6 |
|
|
|
|
|
#3 |
|
Senior Member
Iscritto dal: May 2002
Città: udine
Messaggi: 546
|
...mi regalo un up!
__________________
a chi non piace il vino... dio neghi anche l'acqua! ![]() DELL Latitude E4300, iPhone 6 |
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 23:15.




















