davy_g
Well-known member
Hi,
I use a selfwritten logmodule which logs data in a textfile. I also want to log the selects, inserts, updates etc which are used in the SelectCommand, UpdateCommand etc.
Is there a way where I can fetch this command in a variable? Maybe even with the parameters it's using?
In this way it will be easier to know what is wrong based on the logfile.
Below is the code I mean:
Ripped it out of the dataset.designer.vb.
I use a selfwritten logmodule which logs data in a textfile. I also want to log the selects, inserts, updates etc which are used in the SelectCommand, UpdateCommand etc.
Is there a way where I can fetch this command in a variable? Maybe even with the parameters it's using?
In this way it will be easier to know what is wrong based on the logfile.
Below is the code I mean:
VB.NET:
Private Sub InitCommandCollection()
Me._commandCollection = New System.Data.OleDb.OleDbCommand(0) {}
Me._commandCollection(0) = New System.Data.OleDb.OleDbCommand
Me._commandCollection(0).Connection = Me.Connection
Me._commandCollection(0).CommandText = "SELECT Id, Datum, Dienst, Uren, Norm"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"FROM Uren"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"WHERE Datum >= ?"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"AND Datum < ?"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"ORDER BY Datum"
Me._commandCollection(0).CommandType = System.Data.CommandType.Text
Me._commandCollection(0).Parameters.Add(New System.Data.OleDb.OleDbParameter("Datum", System.Data.OleDb.OleDbType.[Date], 0, System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Datum", System.Data.DataRowVersion.Current, false, Nothing))
Me._commandCollection(0).Parameters.Add(New System.Data.OleDb.OleDbParameter("Datum1", System.Data.OleDb.OleDbType.[Date], 0, System.Data.ParameterDirection.Input, CType(0,Byte), CType(0,Byte), "Datum", System.Data.DataRowVersion.Current, false, Nothing))
End Sub
Ripped it out of the dataset.designer.vb.
Last edited: