why does binding to datagrid affect RDO recordset?
hiya,
For complicated reasons, I have to use RDO to perform updates in my .NET app :-(
My question, why does the RDO recordset become "readOnly" if the contents of the underlying datafile are bound to a datagrid via ODBC?
I ask because, if I:
1) use an odbcDatareader
2) populate a datatable from this dataReader
3) bind the datagrid to this table...
then the RDO recordset is once again "readWrite"
does anyone know why?BTW, I am the only person using the RDO locally, so I know that it can't be a record locking issue.Please note, I NEVER bind the RDO recordset to the datagrid..I only use the RDO recordset to send updates to the datafiles
many thanks,
Chris
Re: why does binding to datagrid affect RDO recordset?
Quote:
Originally Posted by yogiberr
My question, why does the RDO recordset become "readOnly" if the contents of the underlying datafile are bound to a datagrid via ODBC?
...and then:
Quote:
Originally Posted by yogiberr
Please note, I NEVER bind the RDO recordset to the datagrid..I only use the RDO recordset to send updates to the datafiles
Eh? :confused:
So you manually add data to the datagrid by looping through each record?
Woka
Re: why does binding to datagrid affect RDO recordset?
hiya,
I'll rephrase:
I do one of 2 approaches
<approachOne>
1) I databind the datagrid to an odbcdatareader ' NO RDO yet
2) when I want to "update" I have to bring an RDO recSet from the databse, so that I can "edit and update"
The RDO recSet is somehow set to readOnly...WHY?
<\approachOne>
<approachTwo>
1) use an odbcDatareader ' NO RDO yet
2) populate a datatable from this dataReader ' NO RDO yet
3) bind the datagrid to this table... ' NO RDO yet
4) when I want to "update" I have to bring an RDO recSet from the databse, so that I can "edit and update"
I now CAN update the RDO recoSet
<\approachTwo>
Simply put, I want an updatable RDO recSet, but I do not want to go thru the hassle of create an odbcDataReader and assigning its contents to a datatable.
So, WHY is RDO recSet "readOnly if I take appraochOne?
Please remember that at NO POINT is the RDO recSet bound to a datagrid.The ONLY reason I am using RDO is that I have use it to write to the underlying datafiles
Can I clarify anything?
cheers,
Chris
Re: why does binding to datagrid affect RDO recordset?
Nope. You have clarified enough :D
Don't suppose you have the bit of code that gets the RDO object?
Woka
Re: why does binding to datagrid affect RDO recordset?
righto,
Sometimes it's hard to know if I'm explaining things clearly :-)
As I say, the IDENTICAL code allows me to write to the RDO recSet if I use an odbcDatareder, then assign the contents to a datatable before binding to the datagrid..that is the CRUX of the issue
<code>
Friend RDOrdoEngine_definst As New RDO.rdoEngine
Dim rdoConn As RDO.rdoConnection
Dim rdoEnv As RDO.rdoEnvironment
Dim rdoEnvs As RDO.rdoEnvironments
Dim rdoRS As RDO.rdoResultset
rdoEnvs = RDOrdoEngine_definst.rdoEnvironments
rdoEnv = rdoEnvs(0)
rdoEnv.CursorDriver = RDO.CursorDriverConstants.rdUseServer
rdoConn = rdoEnv.OpenConnection("", RDO.PromptConstants.rdDriverNoPrompt, False, "valid connString")
Dim strSQL As String
strSQL = "SELECT blah blah"
rdoRS = rdoConn.OpenResultset(strSQL, RDO.ResultsetTypeConstants.rdOpenKeyset, RDO.LockTypeConstants.rdConcurLock)
With rdoRS
.MoveFirst
.Edit() ' readWrite error here
.rdoColumns("validFieldName").Value = CStr("validValue")
.Update()
End With
<\code>
Any ideas?
many thanks,
Chris :wave:
Re: why does binding to datagrid affect RDO recordset?
Hmmm..can't get RDO into my project :(
try:
rdConcurRowVer
instead of
rdConcurLock
In the OpenResultSet mthod call.
Is there any reason why ADO.NET is not aceptable to use?
Woka
Re: why does binding to datagrid affect RDO recordset?
hiya,
Apparently, it is now working..not sure why.
I couldn't use ado.net because I was working with sage datafiles...a long story :-0
ta for the help,
Chris