Adodb.recordset in a datagridview
-
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 ~~~
-
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 ~~~
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
-
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
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 ~~~
-
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 ~~~
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
-
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
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 ~~~
-
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 ~~~
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
-
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