ADO recordset to Datagridview of VB 2005



Hi,

I have installed Visual Studio 2005 and am working on Visual
Basic. I have created a ADODB connection to a DB2 database in a server
whose IP address, Portnumber, hostname... are known to me. I have
created a recordset also and assigned a query to it.

Dim Adcon as ADODB.Connection
Dim Adors as ADODB.Recordset
Adcon = New ADODB.Connection
Adors = New ADODB.Recordset

adcon.open (<Connection String>)
Adors.CursorLocation = CursorLocationEnum.adUseClient
Adors.Open(<Query>, Adcon, CursorTypeEnum.adOpenDynamic,
LockTypeEnum.adLockOptimistic)
DataGridView1.DataSource = Adors

I am using the above mentioned steps. Before Assigning the Recordset
to Data grid view, I have checked if the recordset has values and
found that recordset retreived correct set of records using watch. But
the datagridview remains empty even after using the statement
"DataGridView1.DataSource = Adors". I am not sure why this happens.
Please let me know if there is a solution.

Note: The same piece of code works well in VB 6.0 for a Datagrid
control. Also, when I use project upgrading from VB6.0 to VB 2005, the
same datagrid control is working.

.



Relevant Pages

  • Executing a StoredProcedure using ADOCommand object in ASP.NET 2.0
    ... Now since this page has been changed to ASPX page 2.0 with the page ... ADODB.Recordset adoRS = new ADODB.Recordset; ... line adoRS = adoCommand.Execute(out recordsAffected, ref parameters, ... I only want the data to come back as a RecordSet so that I've to change ...
    (microsoft.public.data.oledb)
  • RE: Problem with returning a recordset from a VBA function
    ... Access report by doing the following: ... Within this function I decalre an internal adoRs object that calls the ... stored procedure and then do Set GetPhysicianData = adoRS. ... recordset is closed. ...
    (microsoft.public.access.modulesdaovba)
  • Use a recordset inside a Function?
    ... I'm trying to use a recordset inside of a function but I'm getting an "object required 'adoRS" error. ... Set adoCN = server.CreateObject ... function GetRecords() ...
    (microsoft.public.inetserver.asp.general)
  • RE: Problem with returning a recordset from a VBA function
    ... If you need to set the report's recordset, ... "Dave" wrote: ... Access report by doing the following: ... Within this function I decalre an internal adoRs object that calls the ...
    (microsoft.public.access.modulesdaovba)
  • Re: Visual FoxPro Driver With VB - Pack Problem
    ... Set conn1 = New ADODB.Connection ... > Set conn6 = New ADODB Connection ... > Set rs6 = New ADODB Recordset ... > Why does the Driver think the file is still in use after the recordset and> connection are Closed and set to Nothing? ...
    (microsoft.public.vb.database.ado)