Public Overloads Function GetDataTable(ByVal sp As String, ByVal ParamArray params() As SqlParameter) As DataTable Try Dim conn As New SqlConnection conn = GetConnection() Dim cmd As New SqlCommand Dim p As SqlParameter With cmd .Connection = conn .CommandType = CommandType.StoredProcedure .CommandText = sp For Each p In params p = cmd.Parameters.Add(p) p.Direction = ParameterDirection.Input Next End With Dim da As New SqlDataAdapter Dim dt As New DataTable With da .SelectCommand = cmd .Fill(dt) End With CloseConnection(conn) cmd.Dispose() Return dt Catch ex As Exception cMail.SendErrorEmail(strUserEmail, " data GetDataTable()", ex) End Try End Function
Gain unlimited access to on-demand training courses with an Experts Exchange subscription.Get Access
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.