Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Adodb.recordset in a datagridview

Adodb.recordset in a datagridview

Scheduled Pinned Locked Moved Visual Basic
helpdatabasetutorialquestion
7 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rey9999
    wrote on last edited by
    #1

    Hello to everyone. for my project i need to display some data in a datagridview. these data are contained in an Adodb.recordset object, that is given from an external class they gave me (and i am _forced_ to use adodb.recordsets). the problem is, i can't set the datasource for the datagridview to be the recordset. i'll give you an example: Dim dy As New ADODB.Recordset Dim query As String = "SELECT * FROM table1" ''MyConn is an instance of the class i must use MyConn.OpenRecordset(dy, query) at this point i would write: DataGridView1.DataSource = dy it doesn't give me an error, but it doesn't work either, my datagridview remains empty. is there any way to work on it without using datasets? i sadly have to use recordsets... thanks in advance and sorry for my bad english. ~~~ From Milano to The Hague, easy as it goes ~~~

    D 1 Reply Last reply
    0
    • R Rey9999

      Hello to everyone. for my project i need to display some data in a datagridview. these data are contained in an Adodb.recordset object, that is given from an external class they gave me (and i am _forced_ to use adodb.recordsets). the problem is, i can't set the datasource for the datagridview to be the recordset. i'll give you an example: Dim dy As New ADODB.Recordset Dim query As String = "SELECT * FROM table1" ''MyConn is an instance of the class i must use MyConn.OpenRecordset(dy, query) at this point i would write: DataGridView1.DataSource = dy it doesn't give me an error, but it doesn't work either, my datagridview remains empty. is there any way to work on it without using datasets? i sadly have to use recordsets... thanks in advance and sorry for my bad english. ~~~ From Milano to The Hague, easy as it goes ~~~

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Since the ADODB.Recordset class doesn't support the required Interfaces, you can't use it to bind to a DataGridView. You'll have to translate it into a DataSet object to use the data. If you're writing the code, why on earth do you HAVE to use the older classes???? I see no point to it. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

      R 1 Reply Last reply
      0
      • D Dave Kreskowiak

        Since the ADODB.Recordset class doesn't support the required Interfaces, you can't use it to bind to a DataGridView. You'll have to translate it into a DataSet object to use the data. If you're writing the code, why on earth do you HAVE to use the older classes???? I see no point to it. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

        R Offline
        R Offline
        Rey9999
        wrote on last edited by
        #3

        i HAVE to use the older classes because i work in a place full of quiche-eaters, who programmed in vb 6 until two days ago, and they suddenly decided to go VB.NET. so they hired me (and i am a c# programmer, who programmed serial interfaces with no experiences on databases, not even a vb.net one) and they gave me their old classes, just automatically converted. and of course, they forbid me to rewrite the class from scratch, because otherwise they would not be able to use it. this is my unlucky story... however this morning i found a way, i use an OleDb.OleDbDataAdapter and with the method Fill i convert the recordset to a datatable. thanks anyways for having listened to my rant! ^__^ ~~~ From Milano to The Hague, easy as it goes ~~~

        D 1 Reply Last reply
        0
        • R Rey9999

          i HAVE to use the older classes because i work in a place full of quiche-eaters, who programmed in vb 6 until two days ago, and they suddenly decided to go VB.NET. so they hired me (and i am a c# programmer, who programmed serial interfaces with no experiences on databases, not even a vb.net one) and they gave me their old classes, just automatically converted. and of course, they forbid me to rewrite the class from scratch, because otherwise they would not be able to use it. this is my unlucky story... however this morning i found a way, i use an OleDb.OleDbDataAdapter and with the method Fill i convert the recordset to a datatable. thanks anyways for having listened to my rant! ^__^ ~~~ From Milano to The Hague, easy as it goes ~~~

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          Rey9999 wrote:

          because i work in a place full of quiche-eaters, who programmed in vb 6 until two days ago, and they suddenly decided to go VB.NET.

          :laugh::laugh::laugh:

          Rey9999 wrote:

          and they gave me their old classes, just automatically converted. and of course, they forbid me to rewrite the class from scratch, because otherwise they would not be able to use it.

          :doh: Wouldn't be able to use it or wouldn't be ablt to understand it?? There's a huge difference you know! :-D

          Rey9999 wrote:

          i use an OleDb.OleDbDataAdapter and with the method Fill i convert the recordset to a datatable

          That's exactly what you needed to do. Get the data into a .NET object so you can use it with the .NET classes. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

          R 1 Reply Last reply
          0
          • D Dave Kreskowiak

            Rey9999 wrote:

            because i work in a place full of quiche-eaters, who programmed in vb 6 until two days ago, and they suddenly decided to go VB.NET.

            :laugh::laugh::laugh:

            Rey9999 wrote:

            and they gave me their old classes, just automatically converted. and of course, they forbid me to rewrite the class from scratch, because otherwise they would not be able to use it.

            :doh: Wouldn't be able to use it or wouldn't be ablt to understand it?? There's a huge difference you know! :-D

            Rey9999 wrote:

            i use an OleDb.OleDbDataAdapter and with the method Fill i convert the recordset to a datatable

            That's exactly what you needed to do. Get the data into a .NET object so you can use it with the .NET classes. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

            R Offline
            R Offline
            Rey9999
            wrote on last edited by
            #5

            Dave Kreskowiak wrote:

            Wouldn't be able to use it or wouldn't be ablt to understand it?? There's a huge difference you know!

            they won't understand it, and thus they won't be able to use it when i'll quit the job (in september, i hope ;)) ~~~ From Milano to The Hague, easy as it goes ~~~

            D 1 Reply Last reply
            0
            • R Rey9999

              Dave Kreskowiak wrote:

              Wouldn't be able to use it or wouldn't be ablt to understand it?? There's a huge difference you know!

              they won't understand it, and thus they won't be able to use it when i'll quit the job (in september, i hope ;)) ~~~ From Milano to The Hague, easy as it goes ~~~

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #6

              Don't you hate being the most intelligent person in the room?? Noone to learn anything from... RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

              R 1 Reply Last reply
              0
              • D Dave Kreskowiak

                Don't you hate being the most intelligent person in the room?? Noone to learn anything from... RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

                R Offline
                R Offline
                Rey9999
                wrote on last edited by
                #7

                i should have never taken this job, but you know, they caught me with a "WILL CODE FOR FOOD" sign around my neck... ;) ~~~ From Milano to The Hague, easy as it goes ~~~

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups