Results 1 to 6 of 6

Thread: Datagrid trouble

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2009
    Posts
    96

    Datagrid trouble

    I only want specific columns to show up in my DataGridView, so I run a dynamic sql query to select specific columns from a table on a sql server(I know its slow, but its only used once a day). However, every column from the table shows up in the datagrid, and I can't figure out what i'm doing wrong.

    Code:
    Public Class Assign_Priorities
        Dim connect As New SqlConnection("Data Source=IRNTS4SQL;Initial Catalog=Materials;Integrated Security=True")
        Dim ds As New DataSet
        Dim da As New SqlDataAdapter("SELECT [Priority], [Tool Type], [Lot Number], [Process], [Priority Notes], [Quantity], [Time Job Entry] from [FPAD Process Log]", connect)
        Dim cb As New SqlCommandBuilder
    
        Private Sub Assign_Priorities_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            cb.DataAdapter = da
            da.Fill(ds, "Priorities")
            DataGridView1.DataSource = ds.Tables("Priorities")
        End Sub
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    
            cb.GetUpdateCommand()
            da.Update(ds, "Priorities")
    
        End Sub
    
     
    End Class
    Last edited by theguyinthehat; Oct 6th, 2009 at 10:43 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width