积极答复者
SqlDataSet,中的查询语句,为什么里面那二条都不能执行?谢谢

问题
-
Dim objdataadapte As New SqlDataAdapter( _
"select authors.au_id,au_lname,au_fname,titles.title_id,title,price" & _
"from authors,titles,titleauthor" & _
"where authors.au_id=titleauthor.au_id" & _
"and titleauthor.title_id=titles.title_id" & _
"order by au_lname", objconn)''"SELECT authors.au_id,au_lname,au_fname," & _
''"titles.title_id,title,price" & _
''"FROM authors " & _
''"JOIN titleauthor ON authors.au_id = titleauthor.au_id " & _
''"JOIN titles ON titleauthor.title_id = titles.title_id " & _
''"ORDER BY au_lname ", objconn)
答案
-
你好,好像你的sql裡少了些 space
1) ".....,price" & "from....." = "....,pricefrom"
2) "...author" & "where..." = "...authorwhere"
等等,所以不能運作大家一齊探討、學習和研究,謝謝!
MCSD, MCAD, MCSE+I, MCDBA, MCDST, MCSA, MCTS, MCITP, MCPD,
MCT, Microsoft Community Star(TW & HK),
Microsoft MVP for VB.NET since 2003
My MSMVP Blog- 已建议为答案 ThankfulHeartModerator 2013年4月11日 7:50
- 已标记为答案 WAYNE_W 2013年4月11日 8:19
全部回复
-
你好,好像你的sql裡少了些 space
1) ".....,price" & "from....." = "....,pricefrom"
2) "...author" & "where..." = "...authorwhere"
等等,所以不能運作大家一齊探討、學習和研究,謝謝!
MCSD, MCAD, MCSE+I, MCDBA, MCDST, MCSA, MCTS, MCITP, MCPD,
MCT, Microsoft Community Star(TW & HK),
Microsoft MVP for VB.NET since 2003
My MSMVP Blog- 已建议为答案 ThankfulHeartModerator 2013年4月11日 7:50
- 已标记为答案 WAYNE_W 2013年4月11日 8:19
-
建议以后先把SQL语句在SQL Management Studio中测试之后再黏贴,或者直接调用存储过程:
Dim objdataadapte As New SqlDataAdapter( _ "select authors.au_id,au_lname,au_fname,titles.title_id,title,price " & _ "from authors,titles,titleauthor " & _ "where authors.au_id=titleauthor.au_id " & _ "and titleauthor.title_id=titles.title_id " & _ "order by au_lname", objconn)
If you think one reply solves your problem, please mark it as An Answer, if you think someone's reply helps you, please mark it as a Proposed Answer
Help by clicking:
Click here to donate your rice to the poor
Click to Donate
Click to feed Dogs & Cats