Hello fellow DICs,
I'm having an issue populating a gridview from MSSQL. Here is my work so far:
My main issue is trying to figure out a way to set column numbers automatically based upon the number of columns pulled from the DataTable in MSSQL. The reason I need to do it this way is because this gridview will have multiple configurations based upon the selection of certain radiobuttons. Is this a property in Design View that I am not seeing?
Thanks for any help!
S_John
I'm having an issue populating a gridview from MSSQL. Here is my work so far:
Private Sub RemovePart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim UdtConn As New SqlConnection(sBoMConnectionString) If rdbRemovePart.Checked = True Then Using UdtConn Dim conn As String = "Data Source=OMDC-SCADADEV1;Initial Catalog=BoM;Persist Security Info=True;User ID=bom_app;Password=bom" Dim sql As String = "SELECT * FROM BoM.dbo.Part WHERE Part_Nbr = '" & txtARESearch.Text & "'" 'Dim connection As New SqlConnection(connectionString) Dim dataadapter As New SqlDataAdapter(sql, conn) Dim ds As New DataSet() UdtConn.Open() dataadapter.Fill(ds, "Remove_Part") UdtConn.Close() DataGridView1.DataSource = ds DataGridView1.DataMember = "Remove_Part" End Using End If End Sub
My main issue is trying to figure out a way to set column numbers automatically based upon the number of columns pulled from the DataTable in MSSQL. The reason I need to do it this way is because this gridview will have multiple configurations based upon the selection of certain radiobuttons. Is this a property in Design View that I am not seeing?
Thanks for any help!
S_John