Results 1 to 4 of 4

Thread: working with datagrids

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2011
    Posts
    255

    working with datagrids

    hi

    want im trying to do it when i click my button a datagrid come up with my info from a table in my database.

    i also want it editable so i can make changes.

    i want to happen is if i add a new record to datagrid when i press the add button it gets added. if i update 1 field in my datagrig it gets update etc

    im using vb6 and access database


    anyone any ideas of a good way of doing this

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Oct 2011
    Posts
    255

    Re: working with datagrids

    does anyone no how to diusplay the infro from database in the datagrid

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 2011
    Posts
    255

    Re: working with datagrids

    getting an error with this code

    Code:
    Dim rs As New ADODB.Recordset
    Dim MyConn As ADODB.Connection
    'Set oCnn = New ADODB.Connection
    
    Set MyConn = New ADODB.Connection
    
    MyConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\lida946\Desktop\users.mdb"
    MyConn.Open
    
    Set datagrid1 = New ADODB.Recordset
    
    datagrid1.Open ("SELECT * FROM tblUsers ")
    Set datagrid.DataSource = datagrid1
    error is run-time error 3709

    the connection cannot be used to peform this operation. its either closed or invalid in thsi context

  4. #4
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: working with datagrids

    The easiest possible way to do this is to simply use the data form wizard that is included with VB6.
    All you have to do is point it to the database, then a table, tell it what fields you want and in what order, sorting if you like, what functions you want as in add edit delete and give it a name for your new form.

    This is not the ideal way to do it but it will create a working data form either as a single record or a grid with the ability to add, edit and delete records from your database.


    Run the wizard. Make sure to choose ADO Code from the options then look at the code which is generated. It will give you a much better idea of how you can do this.
    Last edited by DataMiser; Feb 23rd, 2012 at 12:25 PM.

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