M
Miro
I will ask the question first then fumble thru trying to explain myself so i
dont waste too much of your time.
Question / Statement - Every mdb table needs a PrimaryKey ( or maybe an
index - i havnt tested the index yet ) so you
can use an .UPDATE( dataTable ) on the data adapter. Otherwise you will
get an exception error.
Is this statement true?
---- Now me fumbling thru
-I use to use a different language you did not need to create "keys" in the
files. Plus indexes had to be manually
maintained in alternate files. So this is a minor mdb question for
microsoft related files.
Im learning vb.net and basically I have created an mdb file with adox
The mdb file has a table and that table has 1 column and I only ever will
have 1 record
in this table.
Then at one point I update the columns in the "Version" table of the mdb
file like this:
dtVersion.Rows(0)("CurVersion") = NewVersionNo ' I can use Rows( 0 )
cause there will always be 1 record there.
daDataAdapter.Update(dtVersion) ' *** Error will be here ***
Now... I got an error the error line and the error was :
"Dynamic SQL generation for the UpdateCommand is not supported against a
SelectCommand that does not return any key column information."
So I added another field into the Table called RecID and made it a
PrimaryKey ( with adox )
- ADOXTable.Keys.Append("PrimaryKey", ADOX.KeyTypeEnum.adKeyPrimary,
"RecID")
and started the value as something silly as "01" and then the code worked.
I can even change the code like this:
dtVersion.Rows(0)("CurVersion") = NewVersionNo
'dtVersion.Rows(0)("RecID") = "XX" ' *** I can even change the primary key
value but this line is not needed and the code works.
daDataAdapter.Update(dtVersion)
So from what I can understand here, for the Update comman to work, when you
are using a Data Adapter the file needs a key.
Thank you,
Miro
dont waste too much of your time.
Question / Statement - Every mdb table needs a PrimaryKey ( or maybe an
index - i havnt tested the index yet ) so you
can use an .UPDATE( dataTable ) on the data adapter. Otherwise you will
get an exception error.
Is this statement true?
---- Now me fumbling thru
-I use to use a different language you did not need to create "keys" in the
files. Plus indexes had to be manually
maintained in alternate files. So this is a minor mdb question for
microsoft related files.
Im learning vb.net and basically I have created an mdb file with adox
The mdb file has a table and that table has 1 column and I only ever will
have 1 record
in this table.
Then at one point I update the columns in the "Version" table of the mdb
file like this:
dtVersion.Rows(0)("CurVersion") = NewVersionNo ' I can use Rows( 0 )
cause there will always be 1 record there.
daDataAdapter.Update(dtVersion) ' *** Error will be here ***
Now... I got an error the error line and the error was :
"Dynamic SQL generation for the UpdateCommand is not supported against a
SelectCommand that does not return any key column information."
So I added another field into the Table called RecID and made it a
PrimaryKey ( with adox )
- ADOXTable.Keys.Append("PrimaryKey", ADOX.KeyTypeEnum.adKeyPrimary,
"RecID")
and started the value as something silly as "01" and then the code worked.
I can even change the code like this:
dtVersion.Rows(0)("CurVersion") = NewVersionNo
'dtVersion.Rows(0)("RecID") = "XX" ' *** I can even change the primary key
value but this line is not needed and the code works.
daDataAdapter.Update(dtVersion)
So from what I can understand here, for the Update comman to work, when you
are using a Data Adapter the file needs a key.
Thank you,
Miro