troubleshooting Question

Using SqlHelper.ExecuteDataset in VB.Net

Avatar of Sheritlw
SheritlwFlag for United States of America asked on
Visual Basic.NET
7 Comments1 Solution3824 ViewsLast Modified:
Hi Experts,

I am new to .Net and have been reading, reading, reading...
From a previous question, I found out about the Microsoft.ApplicationBlocks.Data and am trying to use this to access my data.
I have created the code below to fill grids (fpSpread).  
Everything I have read says that you always close the connection, but with the sqlhelper I was wondering if this will close the connection for me and if this code is correct?

Public Shared ReadOnly Property ConnectionString() As String
            Return ConfigurationManager.AppSettings("ConnectionString")
        End Get
    End Property
Public Function GetDataSetGrd(ByVal strSQL As String) As DataSet
        Dim ds As New DataSet
            ds = SqlHelper.ExecuteDataset(AppConfig.ConnectionString, _
                                CommandType.Text, strSQL)
            Return ds
            Exit Try
        Catch ex As Exception
            Return Nothing
            If Not ds Is Nothing Then
            End If
        End Try
    End Function

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros