Microsoft Visual Basic 2008 and Microsoft Access 2003

pubCon = New OleDb.OleDbConnection
pubCon.ConnectionString = “Provider=Microsoft.Jet.OleDb.4.0; “ & _               
                        
” Data Source=” & Application.StartupPath & “\Data.mdb”
——————————
Friend Sub LoadData()       
    
Dim da As New OleDb.OleDbDataAdapter(“SELECT classcode, type, [id] “ & _
                                             ” FROM [class]” & _
                                             ” ORDER BY classcode”, pubCon)       
     Dim dt As New DataTable
    
da.Fill(dt)
     
Me.dgvData.DataSource = dt
    
With Me.dgvData
         .Columns(
“id”).Visible = False
         .Columns(
“classcode”).HeaderText = “Class Code”
         .Columns(
“type”).HeaderText = “Class Type”
         .Columns(“classcode”).DefaultCellStyle.Font = New _Font(“Arial”, 11, _
                                                                  FontStyle.Bold)
 
         .Columns(
“classcode”).HeaderCell.Style.Font = New _Font(“Arial”, 11, 
                                                                  FontStyle.Bold)

         
.Columns(“classcode”).Width = .Width * 0.4
         .Columns(“type”).Width = .Width * 0.5       
     
End With
      dt.Dispose()

      da.Dispose()
End Sub

អានព័ត៌មានលម្អិតខាងក្រោមនេះ
http://www.krookroo.com/programming-languages/ms-visual-basic-20052008/80-it-vb9-4.html

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: