2 Replies Latest reply on Jan 15, 2018 7:42 AM by Michael Dekoning

    How to retrieve card data and insert it into datagridview

    Adon Nicholls

      Hi All,

      I am currently trying to create a tool that will be used to search through our Non-Conformance Report cards , take the data such as state and the card number and put it into a datagridview that I have created. I have managed to get it to look at the databases in the vault such as variables but don't know how to get it to pick up tangible data and put them into the data grid created.

       

       

      The code I've got so far for it is:

       

      Private Sub DataGridView1_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles NCRList.CellContentClick

              NCRList.DataSource = NonConformanceList()

          End Sub

       

       

          Private Function NonConformanceList() As DataTable

       

       

              Dim DTVariables As New DataTable

       

       

              Dim ConnString As String = ConfigurationManager.ConnectionStrings("NCR_Tracker.My.MySettings.Rotron_Live_VaultConnectionString2").ConnectionString

       

       

              Using Conn As New SqlConnection(ConnString)

       

       

                  Using CMD As New SqlCommand("Select * From dbo.Variable", Conn)

       

       

                      Conn.Open()

       

       

                      Dim Reader As SqlDataReader = CMD.ExecuteReader()

       

       

                      DTVariables.Load(Reader)

       

                  End Using

              End Using

              Return DTVariables

         End Function

       

       

      Any help would be appreciated.

       

      Kind Regards,

      Adz