OleDBDataAdpter update fails becorse of Fieldname in DB ??

  • Thread starter Thread starter Sagaert Johan
  • Start date Start date
S

Sagaert Johan

The update seems to fail becorse of the fieldname in my DB

One of the fields is called "Zone" in my MDB

If i change the fieldname in both the database and in my test application,
the error is gone....

Any explanation ?
 
It may be a reserved word. I assume you're using access. To get around this,
in your code, refer to the field as [Zone] instead of Zone. The brackets
indicate that you're referring to a field/table/view or other DB object and
not a reserved word.

Pete
 
This does'nt work , it tries to look for the field [Zone]

eg
oOrderRow["[Zone]"] = "bathroom"; does not work


Pete Davis said:
It may be a reserved word. I assume you're using access. To get around this,
in your code, refer to the field as [Zone] instead of Zone. The brackets
indicate that you're referring to a field/table/view or other DB object and
not a reserved word.

Pete

--
http://www.petedavis.net
Sagaert Johan said:
The update seems to fail becorse of the fieldname in my DB

One of the fields is called "Zone" in my MDB

If i change the fieldname in both the database and in my test application,
the error is gone....

Any explanation ?
 
Sorry, my mistake. You don't want the brackets there. You'd want them in the
select statement around the field list (assuming you have a field list). But
in the datarow indexer, you'd simply use oOrderRow["Zone"] = "bathroom";

Pete

--
http://www.petedavis.net
Sagaert Johan said:
This does'nt work , it tries to look for the field [Zone]

eg
oOrderRow["[Zone]"] = "bathroom"; does not work


Pete Davis said:
It may be a reserved word. I assume you're using access. To get around this,
in your code, refer to the field as [Zone] instead of Zone. The brackets
indicate that you're referring to a field/table/view or other DB object and
not a reserved word.

Pete

--
http://www.petedavis.net
Sagaert Johan said:
The update seems to fail becorse of the fieldname in my DB

One of the fields is called "Zone" in my MDB

If i change the fieldname in both the database and in my test application,
the error is gone....

Any explanation ?
 
Back
Top