c#+access多表多条件查询语句怎么写
我数据库里有Topic和User两个表,Topic的字段有:TopicID,LoginName,Title
User的字段有:UserID,LoginName,UserName,PassWord
连接字段是LoginName
现在我想得到一个包含两个表的所有数据的Dataset,条件是当TopicID=topicid; topicid是个变量,正确的查询语句怎么写,我写了个,不过运行时报错了。哪位帮我写下? --------------------编程问答-------------------- Select t.TopicID,t.LoginName,t.Title,u.UserID,u.UserName,u.PassWord
From Topic as t,User as u
Where t.LoginName = u.LoginName And TopicID = topicid; --------------------编程问答-------------------- select a.*,b.* from topic a left join user b on a.topicid=b.topicid
select * from topic a left join user b on a.LoginName=b.LoginName
--------------------编程问答-------------------- sql = "Select [Reply].*,[User].*from [Reply],[User] " + " Where TopicID = " + this._topicID; --------------------编程问答-------------------- 问题已经解决了,我重写了个时对的,应该是这样 sql = "Select [Reply].*,[User].*from [Reply],[User] " + " Where TopicID = " + this._topicID;
补充:.NET技术 , C#