Wednesday, March 13, 2013

ADO.NET Get Data to populate DataTable


#Region "Select Concern Status Values"
        Public Function SelectProvConcernStatus() As DataTable
            Dim dt As New DataTable

            Try
                Using conn As New SqlConnection(ConfigurationManager.ConnectionStrings("conn_string").ConnectionString)
                    conn.Open()
                    Using cmd As New SqlCommand("SELECT concern_status_id, concern_status FROM tbl_provider_concern_status", conn)
                        cmd.CommandType = CommandType.Text
                        Dim sda As SqlDataAdapter = New SqlDataAdapter(cmd)
                        sda.Fill(dt)
                    End Using
                End Using

                Return dt

            Catch ex As Exception
                Throw

            End Try

        End Function


#End Region
Post a Comment