ASP.NET ACCESS 错误报告:FROM 子句语法错误
oledbcom=newOleDbCommand(OleDbCom,oledbcon);//OleDbCom是SQL语句字符串,oledbcon是连接字符串oledbda...
oledbcom = new OleDbCommand(OleDbCom, oledbcon);
//OleDbCom是SQL语句字符串,oledbcon是连接字符串
oledbda = new OleDbDataAdapter();
oledbda.SelectCommand = oledbcom;
DataSet ds = new DataSet();
oledbda.Fill(ds); 《=======此处报错:FROM 子句语法错误
return ds;
当OleDbCom中From跟一个表时,运行正常。当改成一个查询时就报错了。
此查询的SQL是:
SELECT Texts.ID,Texts.Title,Texts.Content,Texts.Time,Texts.UserIP,User.UserName
from Texts
left join User
on Texts.UserID=User.ID
UNION select TextComments.TextID,TextComments.Title,TextComments.Content,TextComments.Time,TextComments.UserIP,User.UserName
from TextComments
left join User
on TextComments.UserID=User.ID
ORDER BY Time; 展开
//OleDbCom是SQL语句字符串,oledbcon是连接字符串
oledbda = new OleDbDataAdapter();
oledbda.SelectCommand = oledbcom;
DataSet ds = new DataSet();
oledbda.Fill(ds); 《=======此处报错:FROM 子句语法错误
return ds;
当OleDbCom中From跟一个表时,运行正常。当改成一个查询时就报错了。
此查询的SQL是:
SELECT Texts.ID,Texts.Title,Texts.Content,Texts.Time,Texts.UserIP,User.UserName
from Texts
left join User
on Texts.UserID=User.ID
UNION select TextComments.TextID,TextComments.Title,TextComments.Content,TextComments.Time,TextComments.UserIP,User.UserName
from TextComments
left join User
on TextComments.UserID=User.ID
ORDER BY Time; 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询