这是我的 SELECT 查询代码。SELECT * FROM TableName WHERE (DateField = Date)
function out = SQL_Simple( DBName, TableName, Date, DateField, SortField, Limits )
logintimeout(60);
conurl = ['jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)}; DBQ=' DBName];
conn = database('','','','sun.jdbc.odbc.JdbcOdbcDriver', conurl);
Limits = Limits + 1;
sql = ['SELECT * FROM ' TableName ];
sql = [sql ' WHERE (' DateField ' = ' Date ')'];
interest = fetch(exec(conn, sql));
%sql = [sql ' ORDER BY ' SortField ' DESC' ];
%sql = [sql ' LIMIT ' Limits];
close(conn);
out = interest.Data;
end
它不起作用。
这个查询有什么问题?
DateField
有类型adDate
。
Date
有格式dd.mm.yyyy
。
ps:
这是数据库中的表:
DBTable.Name = "MyTable"
DBTable.Columns.Append "StrField", adVarWChar, 160
DBTable.Columns.Append "DoubleField", adDouble, 40
DBTable.Columns.Append "IntField", adInteger
DBTable.Columns.Append "CurField", adCurrency
DBTable.Columns.Append "Today", adDate
DateField='Today'
. (在matlab
代码中)
我试图写这样的东西:
sql = ['SELECT * FROM ' TableName ];
sql = [sql ' WHERE (' DateField ' = ''' Date ''');' ];
它也不起作用:((在这里Date = '2010-12-31 00:00:00.0'
,DateField = 'Today'
)