This topic has been archived. It cannot be replied.
-
工作学习 / IT技术讨论 / 请教:把EXCEL做DATABASE,用ODBC,在VB中怎样写SQL语句来提取数据:SELECT * FROM ??????或能不能这样做?谢谢!
-jang(jang);
2004-3-24
(#1657070@0)
-
Never tried, don't think so.
-charleslike(Unionville-愚人);
2004-3-24
(#1657072@0)
-
谢谢!那奇怪为什么在ODBC中又允许EXCEL做数据源?
-jang(jang);
2004-3-24
(#1657095@0)
-
Sorry, it is ok, just tested.
-charleslike(Unionville-愚人);
2004-3-24
(#1657119@0)
-
How?
-jang(jang);
2004-3-24
(#1657122@0)
-
ADO
-canadiantire(Crappy Tire);
2004-3-24
(#1657098@0)
-
yes, i'm using ADO. just don't know the syntax of SQL for EXCEL. Thanks.
-jang(jang);
2004-3-24
(#1657130@0)
-
可以。。sheet name就是表名
-expertune(伪劣);
2004-3-24
(#1657102@0)
-
对了,sheetname后面要加个!还是 $,忘了。。。
-expertune(伪劣);
2004-3-24
(#1657109@0)
-
Not working. Thanks.
-jang(jang);
2004-3-24
(#1657123@0)
-
Here is how:insert MS DAO from Reference, name the column your want to select (named range) as, for example, "mycol"
Dim db as DAO.Database
Dim rs as DAO.Recordset
set db = OpenDatabase("myfile.xls", , "Excel 8.0")
set rs = db.OpenRecordset("SELECT * from mycol ")
...
-canadiantire(Crappy Tire);
2004-3-24
{278}
(#1657212@0)
-
Thanks. It doesn't work. Error: unrecognized database format.
-jang(jang);
2004-3-24
(#1657419@0)
-
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndao/html/daotoadoupdate_topic4.aspDatabase String
dBASE III dBASE III;
dBASE IV dBASE IV;
dBASE 5 dBASE 5.0;
Paradox 3.x Paradox 3.x;
Paradox 4.x Paradox 4.x;
Paradox 5.x Paradox 5.x;
Excel 3.0 Excel 3.0;
Excel 4.0 Excel 4.0;
Excel 5.0/Excel 95 Excel 5.0;
Excel 97 Excel 97;
Excel 2000 Excel 8.0;
HTML Import HTML Import;
HTML Export HTML Export;
Text Text;
ODBC ODBC;
DATABASE=database;
UID=user;
PWD=password;
DSN=datasourcename;
-canadiantire(Crappy Tire);
2004-3-24
{432}
(#1657438@0)
-
Ah, at last, I made it. The syntax is: "select * from [sheetname$]". Many thanks to everyone!
-jang(jang);
2004-3-24
(#1657582@0)
-
You must have correct connection string. such as..
-schen(糊涂阿福);
2004-3-24
{256}
(#1657598@0)
-
选择excel中你需要的数据,第一行应该是属姓名,后面是值,然后insert-->name-->define-->输入一个名字,这个名字就是select * from 中的table的名字。
-haihai(雪舞);
2004-3-24
(#1657618@0)
-
Why ADO?!, To use the Excel object is very simple and straight. (1) Declare a veriable (2) Set a value, Done.
-debater(say something);
2004-3-27
(#1661218@0)