title: solutions needed to fill datagrid via class through select store procedure
body: <p>Situation:</p>
  
  <p>Form - contains dataGridView ( need to be populated )</p>
  
  <p>Class - should contain all the process of filling</p>
  
  <p>what i am doing in class?</p>
  
  <p>     </p>
  
  <pre class="lang-vb prettyprint-override"><code> Public Function prodcatgetdata(ByVal cmd As String) As DataTable
      Try
  
          Dim command As New SqlCommand(cmd)
          Dim dsprodcat As New DataSet
          Dim cn1 As New SqlConnection("data source =SC\SQLEXPRESS;initial catalog=mydb;integrated security=true")
          Dim daprodcat As New SqlDataAdapter(selectprodcat, cn1)
          cn1.Open()
          'daprodcat.SelectCommand = cmd
          daprodcat.Fill(dsprodcat)
          Return dsprodcat.Tables("m_prodcat")
          cn.Close()
      Catch ex As Exception
          MsgBox(ex.Message)
      End Try
  End Function
  </code></pre>
  
  <p>what i am doing in formload() ?</p>
  
  <pre class="lang-vb prettyprint-override"><code>prodcatcls.prodcatgetdata(selectprodcat)
  </code></pre>
  
  <p>where i am going wrong ?</p>