1、select * from test where num=val('"& text1.text &"')"
2、select * from test where num='"& text1.text &"'"num为数字型字体段
在SQL SERVER数据库中不能识别语句 1
在ACCESS中可以识别以上语句 2
有什么办法可以让两个数据库同时都可以识别如果num为datetime那又该怎样写语句。。
2、select * from test where num='"& text1.text &"'"num为数字型字体段
在SQL SERVER数据库中不能识别语句 1
在ACCESS中可以识别以上语句 2
有什么办法可以让两个数据库同时都可以识别如果num为datetime那又该怎样写语句。。
strSQL="select * from test where num=" & text1
如果num为datetime那又该怎样写语句。
Access:
strSQL="select * from test where num=#" & text1 & "#"SQL Server:
strSQL="select * from test where num='" & text1 & "'"
一定要用同一个语句吗?你加一个判断不就行了?检查连接字串,根据字串不同,来选取合适的SQL语句。这才是正确的思路。