What is this for "Catch ex As Exception"

M

momo

I need someone to please explain what the "TRY" does and how it work. How do
I know if it is working or not.


I have this in my code and I don't know what it does, especially this "Catch
ex As Exception"

Try
'Create the connection and command objects
oConn = GetMsAccessOledbConnection(Pathdb, "admin", "")
'oConn = New OleDbConnection(sConn)

oComm = New OleDbDataAdapter(sComm, oConn)
'Fill the dataset with the results of the query
oComm.Fill(oDataSet, "Employees")

'Set the grid source to the dataset and bind the data
oGrid.DataSource=oDataSet.Tables("Employees").DefaultView
oGrid.DataBind()
Catch ex As Exception
'if there is a database error, it will get caught here
oDataSet = Nothing
Finally
'Ensure that the objects are disposed
oComm.Dispose()
oConn.Dispose()
End Try

--


Thanks,


Moses Nueman
Nueman Technologies
http://www.NuemanTech.com
Ph: 704-644-1220
Fax: 704-675-5169
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top