Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

log file

i have a datadriven form which is fetching data from sql server and displaying it into textfile now i want if any error occures in this application then it will log error into the following database tabel

i have created following fields,And table name is ErrorLogFile
errorid auto
edate datetime
edetails varchar

how can i store error information into the this table

plz help me


i am using vb.net 2003 and sql server 2000
[476 byte] By [him_mca] at [2007-11-11 10:14:25]
# 1 Re: log file
Dim conn As SqlConnection
Dim cmd As SqlCommand
' Replace serverName and databaseName with
' the names of your SQL Server and database
Dim ConnectionString As String = "Server=serverName;Database=databaseName;Trusted_Connection=True;"

conn = New SqlConnection(ConnectionString)
cmd = New SqlCommand("INSERT INTO ErrorLogFile (EDate, EDetails) VALUES ('01/23/2007', 'EDetails Value')", conn)
conn.Open()
cmd.ExecuteNonQuery()
conn.Close()
Phil Weber at 2007-11-11 20:48:28 >