-
Jun 28th, 2006, 09:29 AM
#1
Thread Starter
New Member
Datagrid connection with ADODB
Hi there,
I was wondering how I can connect a datagrid using a Adodb connection, if someone knows how please let me know.
Thank you in advance...........
-
Jun 28th, 2006, 10:12 AM
#2
Re: Datagrid connection with ADODB
Here is one method.
VB Code:
Private Sub Form_Load() Dim db As ADODB.Connection Dim rs As ADODB.Recordset Set db = New ADODB.Connection db.Open "provider=sqloledb;data source=(local);integrated security=sspi" db.DefaultDatabase = "Northwind" Set rs = New ADODB.Recordset rs.CursorLocation = adUseClient rs.Open "Select * From Customers", db, adOpenStatic, adLockReadOnly Set rs.ActiveConnection = Nothing Set DataGrid1.DataSource = rs Set rs = Nothing db.Close Set db = Nothing End Sub
-
Jun 28th, 2006, 10:14 AM
#3
Re: Datagrid connection with ADODB
Like many other members I don't use the DataGrid. What I tend to use is a FlexGrid, which can be easily filled from an ADODB connection - see the link in my signature for example code.
-
Jun 28th, 2006, 09:16 PM
#4
New Member
Re: Datagrid connection with ADODB
 Originally Posted by si_the_geek
Like many other members I don't use the DataGrid. What I tend to use is a FlexGrid, which can be easily filled from an ADODB connection - see the link in my signature for example code.
hi geek,
what is the real advantages and disadvantages of datagrid compared to flexgrid?
-
Jun 29th, 2006, 04:59 AM
#5
Thread Starter
New Member
Re: Datagrid connection with ADODB
Hi,
I was also wondering how I can add a drop-down list within a datagrid or flexgrid. This dropdown should be able to have values which can updated that current record.
Any ideas..................
-
Jun 29th, 2006, 08:28 AM
#6
Re: Datagrid connection with ADODB
Here's one way... when a cell is entered, you could show a combobox (which was hidden until then) over the top of the cell. When a value is selected in the combobox, that value is copied to the cell, and the combobox is hidden again.
 Originally Posted by DPSK
what is the real advantages and disadvantages of datagrid compared to flexgrid?
The big difference is that the DataGrid is bound (the data is filled automatically, and changes are written to the database), whereas the FlexGrid isn't (it needs to be filled using code, and does not update the database unless you write code to do that).
Obviously whether or not this is a good or bad thing depends on the situation.
-
Jun 30th, 2006, 01:50 AM
#7
Thread Starter
New Member
Re: Datagrid connection with ADODB
Hey Si,
I've been trying out your possible solution and I really struggling, If you have coded something like this, please show me as its very important. I'll keep on trying. The problem I'm having is the combobox is not updating the field in the record.
I look forward to hearing from you. Thanks..........
-
Jun 30th, 2006, 09:30 AM
#8
Re: Datagrid connection with ADODB
I have done it before, but I don't have the code available.. not that it would help anyway, as your project probably works in a different way to how mine did.
If you post your form, we can suggest changes for you to make to get it working.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|