January 23rd, 2000, 09:47 PM
I'm trying to code a DataGrid, but I don't want to have to include an ADO Data Control. So far, none of the many controls I have used in this project are data bound, and I don't want to break precident. The MSDN Library is quite vague with regards to this control, but does say the following:
"The data-aware DataGrid control appears similar to the Grid control; however, you can set the DataGrid control's DataSource property to a Data control so that the control is automatically filled and its column headers set automatically from a Data control's Recordset object. The DataGrid control is really a fixed collection of columns, each with an indeterminate number of rows."
I, for the life of me, can not get the grid to recognize my recordset object with the folowing code:
public cnnPMIS as ADODB.Connection
public cmdSQL as ADODB.Command
public rstDATA as ADODB.Recordset
public strConnect as string
'Connect to database
strConnect = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=false;" _
& "Data Source=D:\VB_Projects\PMIS\PMIS.mdb"
set cnnPMIS = new ADODB.Connection
cnnPMIS.Open strConnect
'Create command
set cmdSQL = new ADODB.Command
set cmdSQL.ActiveConnection = cnnPMIS
'Create recordset
set rstDATA = new ADODB.Recordset
rstDATA.CursorType = adOpenKeyset
rstDATA.LockType = adLockOptimistic
'Create SQL command
cmdSQL.CommandText = "SELECT * FROM Track WHERE TrkRecID = " _
& lngRecID
'Open recordset
rstDATA.Open cmdSQL
Any help would be appreciated.
CFGH
"The data-aware DataGrid control appears similar to the Grid control; however, you can set the DataGrid control's DataSource property to a Data control so that the control is automatically filled and its column headers set automatically from a Data control's Recordset object. The DataGrid control is really a fixed collection of columns, each with an indeterminate number of rows."
I, for the life of me, can not get the grid to recognize my recordset object with the folowing code:
public cnnPMIS as ADODB.Connection
public cmdSQL as ADODB.Command
public rstDATA as ADODB.Recordset
public strConnect as string
'Connect to database
strConnect = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=false;" _
& "Data Source=D:\VB_Projects\PMIS\PMIS.mdb"
set cnnPMIS = new ADODB.Connection
cnnPMIS.Open strConnect
'Create command
set cmdSQL = new ADODB.Command
set cmdSQL.ActiveConnection = cnnPMIS
'Create recordset
set rstDATA = new ADODB.Recordset
rstDATA.CursorType = adOpenKeyset
rstDATA.LockType = adLockOptimistic
'Create SQL command
cmdSQL.CommandText = "SELECT * FROM Track WHERE TrkRecID = " _
& lngRecID
'Open recordset
rstDATA.Open cmdSQL
Any help would be appreciated.
CFGH