CDaoTableDef::CreateField() Error 3421 - Very strange problem! 
Author Message
 CDaoTableDef::CreateField() Error 3421 - Very strange problem!

Hi there!

I have a very strange problem with VC7 using DAO 3.6. Maybe someone can help
me.

I try to create a new field in a table with the following code:

---- snip ----
CDaoDatabase db;
db.Open("test.mdb");
CDaoTableDef table(&db);
table.Open("Track");
table.CreateField("L_Format", dbLong, 4);      // (*) Create Field
"L_Format" in table "Track"
table.Close();
dc.Close();
---- snip ----

However the line marked with a (*) throws a CDaoException with error code
3421 (adErrDataConversion). This only happens, when I compile a RELEASE
build. The code works perfectly with a DEBUG build. Also this is new for
VC7. The same code works without problems in VC6 (RELEASE and DEBUG).
I think, the "L_Format" field isn't a reserved word because the code works
in DEBUG mode. But when I change the field name to e.g. "L_Format1"
everything works perfectly. However, this is not an option for me.

So, I am very confused. :-(
Thanks for your help.

Jrgen



Wed, 06 Oct 2004 05:17:03 GMT  
 CDaoTableDef::CreateField() Error 3421 - Very strange problem!

Quote:

> Hi there!

> I have a very strange problem with VC7 using DAO 3.6. Maybe someone can help
> me.

> I try to create a new field in a table with the following code:

> ---- snip ----
> CDaoDatabase db;
> db.Open("test.mdb");
> CDaoTableDef table(&db);
> table.Open("Track");
> table.CreateField("L_Format", dbLong, 4);      // (*) Create Field
> "L_Format" in table "Track"
> table.Close();
> dc.Close();
> ---- snip ----

> However the line marked with a (*) throws a CDaoException with error code
> 3421 (adErrDataConversion). This only happens, when I compile a RELEASE
> build. The code works perfectly with a DEBUG build. Also this is new for
> VC7. The same code works without problems in VC6 (RELEASE and DEBUG).
> I think, the "L_Format" field isn't a reserved word because the code works
> in DEBUG mode. But when I change the field name to e.g. "L_Format1"
> everything works perfectly. However, this is not an option for me.

> So, I am very confused. :-(
> Thanks for your help.

> Jrgen

Hi
I have the same problem.
I think, that is the bug.
Try create field with field name string length <> 8 and <>2.
If name string length is equal 8 or 2 function CreateField() throws a
CDaoException (only in RELEASE mode). I dont know why.

P.S.
I must convert my project to VC.Net and I must convert all databases.
If you know some new about this bug, write me please.

Milan



Sat, 09 Oct 2004 19:58:19 GMT  
 CDaoTableDef::CreateField() Error 3421 - Very strange problem!
Paul,

thanks for your suggestion. However, this does not solve my problem. :-(

Jrgen



Quote:
> Jrgen,

> Try this line and see if it helps:

> table.CreateField(_T("L_Format"), dbLong, 4);      // (*) Create Field

> CreateField takes a LPCTSTR for the first parameter, and depending on
> how you are building your app, the _T() macro might fix the problem.

> Paul


> >Hi there!

> >I have a very strange problem with VC7 using DAO 3.6. Maybe someone can
help
> >me.

> >I try to create a new field in a table with the following code:

> >---- snip ----
> >CDaoDatabase db;
> >db.Open("test.mdb");
> >CDaoTableDef table(&db);
> >table.Open("Track");
> >table.CreateField("L_Format", dbLong, 4);      // (*) Create Field
> >"L_Format" in table "Track"
> >table.Close();
> >dc.Close();
> >---- snip ----

> >However the line marked with a (*) throws a CDaoException with error code
> >3421 (adErrDataConversion). This only happens, when I compile a RELEASE
> >build. The code works perfectly with a DEBUG build. Also this is new for
> >VC7. The same code works without problems in VC6 (RELEASE and DEBUG).
> >I think, the "L_Format" field isn't a reserved word because the code
works
> >in DEBUG mode. But when I change the field name to e.g. "L_Format1"
> >everything works perfectly. However, this is not an option for me.

> >So, I am very confused. :-(
> >Thanks for your help.

> >Jrgen

> ----
> Paul Hurley
> Caliban Computing
> http://www.Caliban.com/
> Spam resistant return email address.



Tue, 12 Oct 2004 07:24:04 GMT  
 CDaoTableDef::CreateField() Error 3421 - Very strange problem!


Quote:
> > Hi there!

> > I have a very strange problem with VC7 using DAO 3.6. Maybe someone can
help
> > me.

> > I try to create a new field in a table with the following code:

> > ---- snip ----
> > CDaoDatabase db;
> > db.Open("test.mdb");
> > CDaoTableDef table(&db);
> > table.Open("Track");
> > table.CreateField("L_Format", dbLong, 4);      // (*) Create Field
> > "L_Format" in table "Track"
> > table.Close();
> > dc.Close();
> > ---- snip ----

> > However the line marked with a (*) throws a CDaoException with error
code
> > 3421 (adErrDataConversion). This only happens, when I compile a RELEASE
> > build. The code works perfectly with a DEBUG build. Also this is new for
> > VC7. The same code works without problems in VC6 (RELEASE and DEBUG).
> > I think, the "L_Format" field isn't a reserved word because the code
works
> > in DEBUG mode. But when I change the field name to e.g. "L_Format1"
> > everything works perfectly. However, this is not an option for me.

> > So, I am very confused. :-(
> > Thanks for your help.

> > Jrgen

> Hi
> I have the same problem.
> I think, that is the bug.
> Try create field with field name string length <> 8 and <>2.
> If name string length is equal 8 or 2 function CreateField() throws a
> CDaoException (only in RELEASE mode). I dont know why.

> P.S.
> I must convert my project to VC.NET and I must convert all databases.
> If you know some new about this bug, write me please.

> Milan

Yes, it seems you are right. I tried several field names and the exception
only occurs, if the field name has eight (8) characters! This is really
confusing. For me this seems to be a bug in VC.Net!
Can anybody confirm? Maybe someone from MS?

Jrgen



Tue, 12 Oct 2004 07:28:51 GMT  
 CDaoTableDef::CreateField() Error 3421 - Very strange problem!

Quote:





> > > Hi there!

> > > I have a very strange problem with VC7 using DAO 3.6. Maybe someone can
>  help
> > > me.

> > > I try to create a new field in a table with the following code:

> > > ---- snip ----
> > > CDaoDatabase db;
> > > db.Open("test.mdb");
> > > CDaoTableDef table(&db);
> > > table.Open("Track");
> > > table.CreateField("L_Format", dbLong, 4);      // (*) Create Field
> > > "L_Format" in table "Track"
> > > table.Close();
> > > dc.Close();
> > > ---- snip ----

> > > However the line marked with a (*) throws a CDaoException with error
>  code
> > > 3421 (adErrDataConversion). This only happens, when I compile a RELEASE
> > > build. The code works perfectly with a DEBUG build. Also this is new for
> > > VC7. The same code works without problems in VC6 (RELEASE and DEBUG).
> > > I think, the "L_Format" field isn't a reserved word because the code
>  works
> > > in DEBUG mode. But when I change the field name to e.g. "L_Format1"
> > > everything works perfectly. However, this is not an option for me.

> > > So, I am very confused. :-(
> > > Thanks for your help.

> > > Jrgen

> > Hi
> > I have the same problem.
> > I think, that is the bug.
> > Try create field with field name string length <> 8 and <>2.
> > If name string length is equal 8 or 2 function CreateField() throws a
> > CDaoException (only in RELEASE mode). I dont know why.

> > P.S.
> > I must convert my project to VC.NET and I must convert all databases.
> > If you know some new about this bug, write me please.

> > Milan

> Yes, it seems you are right. I tried several field names and the exception
> only occurs, if the field name has eight (8) characters! This is really
> confusing. For me this seems to be a bug in VC.Net!
> Can anybody confirm? Maybe someone from MS?

> Jrgen

Hi Jrgen

Try Set Optimization to Disabled (/0d) or Optimization to Minimize
Size (/01) in your project RELEASE settings.

When Optimization is Minimize Speed (/02) CreateField() throws a
CDaoException.
In DEBUG mode Optimization is disabled.

Milan



Fri, 15 Oct 2004 19:40:39 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. ADO runtime error 3421.

2. CDaoTableDef::CreateField always creates VARCHAR2 when using ODBC to Oracle

3. CreateField - Data type conversion error

4. CDaoTableDef::CreateIndex() problems

5. problem with creating fields with CDaoTableDef

6. Problem with CDaoTableDef

7. newbie:CDaoTableDef name problem

8. CDaoTableDef::CreateIndex() problems

9. _Recordset::AddNew() throws error (Really strange problem)

10. VERRY STRANGE PROBLEM !!! Link error LNK1104

11. createfield(s) and dbase

12. Strange, strange, strange

 

 
Powered by phpBB® Forum Software