|
-
November 16th, 2011, 08:48 PM
#1
HELP: Why EXcute() of CDaodatabase does not work with "CREATE TABLE" sql
Using CDaodatabase and CDaoRecordset to work with Sql2000 personal.
sql = _T("SELECT * INTO YOU FROM MY WHERE 1=2");
db.Execute(sql);
Excute() is doing well with copying a table, but
sql = _T("CREATE TABLE THEY (DATES Long NOT NULL PRIMARY KEY,CROSS Long NULL);");
db.Execute(sql);
Excute( ) does not work!!! it does not work with "CREATE TABLE" sql!!!!
Why??
Last edited by genliu777; November 16th, 2011 at 08:52 PM.
-
November 17th, 2011, 02:16 AM
#2
Re: HELP: Why EXcute() of CDaodatabase does not work with "CREATE TABLE" sql
 Originally Posted by genliu777
Using CDaodatabase and CDaoRecordset to work with Sql2000 personal.
Code:
sql = _T("SELECT * INTO YOU FROM MY WHERE 1=2");
db.Execute(sql);
Excute() is doing well with copying a table, but
How can it copy anything with such a condition: "WHERE 1=2"? 
 Originally Posted by genliu777
Code:
sql = _T("CREATE TABLE THEY (DATES Long NOT NULL PRIMARY KEY,CROSS Long NULL);");
db.Execute(sql);
Excute( ) does not work!!! it does not work with "CREATE TABLE" sql!!!!
Why??
Define "does not work". What error do you get?
Besides, i don't see any exception handling in your code snippet. Don't you use it?
Victor Nijegorodov
-
November 19th, 2011, 01:09 PM
#3
Re: HELP: Why EXcute() of CDaodatabase does not work with "CREATE TABLE" sql
"WHERE 1=2" means copying table structure without any data or record! it works well with ACCESS.
"does not work" according to the create sql words, it should create a table in the database! but no new table is created.
-
November 19th, 2011, 01:23 PM
#4
Re: HELP: Why EXcute() of CDaodatabase does not work with "CREATE TABLE" sql
 Originally Posted by genliu777
"WHERE 1=2" means copying table structure without any data or record! it works well with ACCESS.
Ok, now it is clear.
 Originally Posted by genliu777
"does not work" according to the create sql words, it should create a table in the database! but no new table is created.
Well, then again:
 Originally Posted by VictorN
...
Besides, i don't see any exception handling in your code snippet. Don't you use it? 
Victor Nijegorodov
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|