Click here to Skip to main content
12,948,124 members (70,682 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
Public Class Form1
    Dim con As ADODB.Connection
    Dim rs As ADODB.Recordset
    Dim tb As DataTable
 
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        con = New ADODB.Connection
        rs = New ADODB.Recordset
        tb = New DataTable
        con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\AMEER & SONS\AMEER&SONS.mdb;Persist Security Info=False"
        con.CursorLocation = ADODB.CursorLocationEnum.adUseClient
        con.Open()
        rs.Open("company_info", con, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic, 2)
        grid.DataSource = rs
    End Sub
End Class

This code does not show the error message but datagridview does not show data why? Thanks in advanced.

Edit TR : Please read the posting guidelines and do not SHOUT.
Posted 20-Feb-10 20:32pm
Updated 15-Apr-10 11:14am
v3
Page 1 of 3

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 44

You havn't mapped any data to your DataTable, which you would use to fill the Grid:

tb = New DataTable
...
grid.DataSource = tb
 
  Permalink  
Comments
Member 10403037 15-Feb-14 18:56pm
   
how to fill the grid?
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 55

rs.Open("ventas", con, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic, 2)
Form10.DataGridView1.DataSource = tb

Would be someting like this?
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 56

Public Class Form1
    Dim con As ADODB.Connection
    Dim rs As ADODB.Recordset
    Dim tb As DataTable
 
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        con = New ADODB.Connection
        rs = New ADODB.Recordset
        tb = New DataTable
        con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\AMEER & SONS\AMEER&SONS.mdb;Persist Security Info=False"
        con.CursorLocation = ADODB.CursorLocationEnum.adUseClient
        con.Open()
        rs.Open("company_info", con, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic, 2)
 
        Dim da As New System.Data.OleDb.OleDbDataAdapter()
        Dim ds As New DataSet()
        da.Fill(ds, rs, "company_info")
 
        'rs.Close()  'Cannot close in this method
        rs.ActiveConnection = Nothing
        con.Close()
        rs = Nothing
        con = Nothing
 
        grid.DataSource = (ds.Tables("company_info"))
    End Sub
End Class
  Permalink  
v2
Page 1 of 3
1 2 3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 5,344
CHill60 3,275
Maciej Los 2,703
Jochen Arndt 1,935
ppolymorphe 1,795


Advertise | Privacy | Mobile
Web02 | 2.8.170524.1 | Last Updated 18 Nov 2015
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100