Click here to Skip to main content
11,642,381 members (65,346 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: VB6 VB.NET
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
        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
Edited 15-Apr-10 11:14am
Page 1 of 3

Rate this: bad
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
Member 10403037 at 15-Feb-14 18:56pm
how to fill the grid?
Rate this: bad
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?
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)

Advertise | Privacy | Mobile
Web03 | 2.8.150731.1 | Last Updated 15 Feb 2014
Copyright © CodeProject, 1999-2015
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