2013-12-23 264 views
0

我有一個錯誤,我接力不明白,如果有人可以向我解釋這個問題,因爲它阻止我與我的程序進展。左外部連接問題

錯誤是說我有一個語法錯誤JOIN

代碼

using (OleDbDataAdapter query_prof = new OleDbDataAdapter("SELECT aspnet_Users.AplicationId, aspnet_User.UserName, aspnet_User.LastActivityDate FROM (aspnet_Users LEFT OUTER JOIN UserProfile ON aspnet_User.UserName = UserProfile.UserName) WHERE (UserProfile.UserName IS NULL)", conn)) 
{ 
    query_prof.Fill(dt); 
} 
+2

從FROM表達式中刪除括號 – okrumnow

+2

您在連接語句中具有aspnet_Users,在on子句中具有aspnet_User。 –

+1

爲什麼在簡單的From子句中使用括號? –

回答

4

漏下從FROM子句括號:

FROM (aspnet_Users LEFT OUTER JOIN UserProfile ON aspnet_User.UserName = UserProfile.UserName) 

你應該做:

FROM aspnet_Users LEFT OUTER JOIN UserProfile ON aspnet_User.UserName = UserProfile.UserName 
+2

在評論中@NickZimmerman提到''aspnet_Users'與'aspnet_User'有錯字 – Vache