populating dbgrid

hello,

I am using DBGrid in my project.following is the code used to populate DBGrid with recordset.

'opening connection
Cn_path.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & App.Path & "\dbHRMS.mdb" & "; Persist Security Info=true"
Cn_path.Open

'using recordset
With rs
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.Open "select * from Leave_OB, Cn_path, adOpenKeyset, , adAsyncFetchNonBlocking"
End With

Set DBGrid1.DataSource = rs
my problem is data is not getting displayed in the DBGrid1

thanks in advance
karuna
[702 byte] By [btkaruna] at [2007-11-19 15:15:40]
# 1 Re: populating dbgrid
Have a look here ( http://support.microsoft.com/default.aspx?scid=kb;en-us;313330)
HanneSThEGreaT at 2007-11-9 20:25:59 >
# 2 Re: populating dbgrid
hello HanneSThEGreaT,

Thank you for immediate reply.

In the code i had used
Set dbgrid1.datasource=rs
but the records r not getting displayed in the DBGrid.
I Also tested sql query independently and its showing record.

thanks in advance
karuna
btkaruna at 2007-11-9 20:26:59 >
# 3 Re: populating dbgrid
Hello!
Well your SQL query in my opinion seems to be OK :confused:
I'm thinking that it might be how your DBGrid is set up, In Other Words, What properties have you set for the DBGrid
Can you perhaps include your zipped project
HanneSThEGreaT at 2007-11-9 20:28:02 >
# 4 Re: populating dbgrid
hello,

I am sending sample as zip.please check the project having only single form and using single table.mdb name dbhrms.

thankyou
karuna
btkaruna at 2007-11-9 20:28:57 >
# 5 Re: populating dbgrid
Here's a nice example for you
HanneSThEGreaT at 2007-11-9 20:29:56 >
# 6 Re: populating dbgrid
hello,

Thank you for the project sent .One final question on this.Is it not possible to populate DBGrid without using data control i.e using only adodb connection and recordset(code that is posted).I need to make decision based on ur reply for our project as almost every form we would be using DBGrid.

Thanks a lot once again.

karuna
btkaruna at 2007-11-9 20:31:00 >
# 7 Re: populating dbgrid
hello,

Thank you for the project sent .One final question on this.Is it not possible to populate DBGrid without using data control i.e using only adodb connection and recordset(code that is posted).I need to make decision based on ur reply for our project as almost every form we would be using DBGrid.

Thanks a lot once again.

karuna

I can be wrong, but I don't think so.
You could of course make the ADODBControl or DataControl invisible, though..

Why not use the MSHFlexGrid instead of the DBGrid - it is Much more flexible
HanneSThEGreaT at 2007-11-9 20:32:08 >