G
Guest
Hi,
I have a query in SqlDataSource that has a subquery. I have it working in
AccessDataSource but get error when running it in SqlDataSource. Since I was
told that the .net query builder only allows simple queries, I have ignored
any error messages from the query builder and test it by running the
application.
My sql query is
SELECT Mailboxes.[BoxRowID], Mailboxes.BoxNumber, Mailboxes.LastName,
Mailboxes.PhoneNumber, Mailboxes.DirectoryListing, Mailboxes.[Password],
Mailboxes.FirstName, Mailboxes.BoxStatus,
MailboxStatusXref.BoxStatusDescription, Mailboxes.Flags,
Mailboxes.MaxNewMessages, Mailboxes.MaxSavedMessages,
Mailboxes.MaxMessageLength, Mailboxes.MaxMessageAge,
Mailboxes.GreetingFileID, Mailboxes.NameFileID, Mailboxes.NotificationID,
Mailboxes.NewMessageCount, Mailboxes.SavedMessageCount,
Mailboxes.NoAnswerRetryTime, Mailboxes.NoOwnerRetryTime,
Mailboxes.BusyRetryTime, Mailboxes.NoAnswerRetryCount,
Mailboxes.NoOwnerRetryCount, Mailboxes.BusyRetryCount, Mailboxes.NotifyDelay,
Mailboxes.ConfirmTime, Mailboxes.ProficiencyLevel, Mailboxes.Gender,
Mailboxes.AlarmTriggerCount, Mailboxes.EMAILAddress, Mailboxes.MiddleName,
Mailboxes.OutOfOfficeFileID, MailboxUserLoginXref.UserLogin,
MailboxStatusXref.BoxStatusNumber, MailboxUserLoginXref.[KeyID] AS Expr1,
MailboxUserLoginXref.BoxNumber AS Expr2, (SELECT COUNT([Message.Status]) FROM
Message WHERE ([Mailboxes.BoxNumber] = [Message.Account] AND [Message.Status]
= 'N') GROUP BY [Message.Account]) AS ExprN, (SELECT COUNT([Message.Status])
FROM Message WHERE ([Mailboxes.BoxNumber] = [Message.Account] AND
[Message.Status] = 'S') GROUP BY [Message.Account]) AS ExprS FROM
(((Mailboxes INNER JOIN MailboxUserLoginXref ON Mailboxes.BoxNumber =
MailboxUserLoginXref.BoxNumber) INNER JOIN MailboxStatusXref ON
Mailboxes.BoxStatus = MailboxStatusXref.BoxStatusNumber) LEFT OUTER JOIN
Message ON Mailboxes.BoxNumber = Message.Account) GROUP BY
Mailboxes.[BoxRowID], Mailboxes.BoxNumber, Mailboxes.LastName,
Mailboxes.PhoneNumber, Mailboxes.DirectoryListing, Mailboxes.[Password],
Mailboxes.FirstName, Mailboxes.BoxStatus,
MailboxStatusXref.BoxStatusDescription, Mailboxes.Flags,
Mailboxes.MaxNewMessages, Mailboxes.MaxSavedMessages,
Mailboxes.MaxMessageLength, Mailboxes.MaxMessageAge,
Mailboxes.GreetingFileID, Mailboxes.NameFileID, Mailboxes.NotificationID,
Mailboxes.NewMessageCount, Mailboxes.SavedMessageCount,
Mailboxes.NoAnswerRetryTime, Mailboxes.NoOwnerRetryTime,
Mailboxes.BusyRetryTime, Mailboxes.NoAnswerRetryCount,
Mailboxes.NoOwnerRetryCount, Mailboxes.BusyRetryCount, Mailboxes.NotifyDelay,
Mailboxes.ConfirmTime, Mailboxes.ProficiencyLevel, Mailboxes.Gender,
Mailboxes.AlarmTriggerCount, Mailboxes.EMAILAddress, Mailboxes.MiddleName,
Mailboxes.OutOfOfficeFileID, MailboxUserLoginXref.UserLogin,
MailboxStatusXref.BoxStatusNumber, MailboxUserLoginXref.[KeyID],
MailboxUserLoginXref.BoxNumber HAVING (MailboxUserLoginXref.UserLogin =
@UserLogin)
I get error as folows:
Invalid column name 'Mailboxes.BoxNumber'.
Invalid column name 'Message.Account'.
Invalid column name 'Message.Status'.
Invalid column name 'Message.Account'.
Invalid column name 'Message.Status'.
Invalid column name 'Mailboxes.BoxNumber'.
Invalid column name 'Message.Account'.
Invalid column name 'Message.Status'.
Invalid column name 'Message.Account'.
Invalid column name 'Message.Status'.
Any help would be appreciated.
I have a query in SqlDataSource that has a subquery. I have it working in
AccessDataSource but get error when running it in SqlDataSource. Since I was
told that the .net query builder only allows simple queries, I have ignored
any error messages from the query builder and test it by running the
application.
My sql query is
SELECT Mailboxes.[BoxRowID], Mailboxes.BoxNumber, Mailboxes.LastName,
Mailboxes.PhoneNumber, Mailboxes.DirectoryListing, Mailboxes.[Password],
Mailboxes.FirstName, Mailboxes.BoxStatus,
MailboxStatusXref.BoxStatusDescription, Mailboxes.Flags,
Mailboxes.MaxNewMessages, Mailboxes.MaxSavedMessages,
Mailboxes.MaxMessageLength, Mailboxes.MaxMessageAge,
Mailboxes.GreetingFileID, Mailboxes.NameFileID, Mailboxes.NotificationID,
Mailboxes.NewMessageCount, Mailboxes.SavedMessageCount,
Mailboxes.NoAnswerRetryTime, Mailboxes.NoOwnerRetryTime,
Mailboxes.BusyRetryTime, Mailboxes.NoAnswerRetryCount,
Mailboxes.NoOwnerRetryCount, Mailboxes.BusyRetryCount, Mailboxes.NotifyDelay,
Mailboxes.ConfirmTime, Mailboxes.ProficiencyLevel, Mailboxes.Gender,
Mailboxes.AlarmTriggerCount, Mailboxes.EMAILAddress, Mailboxes.MiddleName,
Mailboxes.OutOfOfficeFileID, MailboxUserLoginXref.UserLogin,
MailboxStatusXref.BoxStatusNumber, MailboxUserLoginXref.[KeyID] AS Expr1,
MailboxUserLoginXref.BoxNumber AS Expr2, (SELECT COUNT([Message.Status]) FROM
Message WHERE ([Mailboxes.BoxNumber] = [Message.Account] AND [Message.Status]
= 'N') GROUP BY [Message.Account]) AS ExprN, (SELECT COUNT([Message.Status])
FROM Message WHERE ([Mailboxes.BoxNumber] = [Message.Account] AND
[Message.Status] = 'S') GROUP BY [Message.Account]) AS ExprS FROM
(((Mailboxes INNER JOIN MailboxUserLoginXref ON Mailboxes.BoxNumber =
MailboxUserLoginXref.BoxNumber) INNER JOIN MailboxStatusXref ON
Mailboxes.BoxStatus = MailboxStatusXref.BoxStatusNumber) LEFT OUTER JOIN
Message ON Mailboxes.BoxNumber = Message.Account) GROUP BY
Mailboxes.[BoxRowID], Mailboxes.BoxNumber, Mailboxes.LastName,
Mailboxes.PhoneNumber, Mailboxes.DirectoryListing, Mailboxes.[Password],
Mailboxes.FirstName, Mailboxes.BoxStatus,
MailboxStatusXref.BoxStatusDescription, Mailboxes.Flags,
Mailboxes.MaxNewMessages, Mailboxes.MaxSavedMessages,
Mailboxes.MaxMessageLength, Mailboxes.MaxMessageAge,
Mailboxes.GreetingFileID, Mailboxes.NameFileID, Mailboxes.NotificationID,
Mailboxes.NewMessageCount, Mailboxes.SavedMessageCount,
Mailboxes.NoAnswerRetryTime, Mailboxes.NoOwnerRetryTime,
Mailboxes.BusyRetryTime, Mailboxes.NoAnswerRetryCount,
Mailboxes.NoOwnerRetryCount, Mailboxes.BusyRetryCount, Mailboxes.NotifyDelay,
Mailboxes.ConfirmTime, Mailboxes.ProficiencyLevel, Mailboxes.Gender,
Mailboxes.AlarmTriggerCount, Mailboxes.EMAILAddress, Mailboxes.MiddleName,
Mailboxes.OutOfOfficeFileID, MailboxUserLoginXref.UserLogin,
MailboxStatusXref.BoxStatusNumber, MailboxUserLoginXref.[KeyID],
MailboxUserLoginXref.BoxNumber HAVING (MailboxUserLoginXref.UserLogin =
@UserLogin)
I get error as folows:
Invalid column name 'Mailboxes.BoxNumber'.
Invalid column name 'Message.Account'.
Invalid column name 'Message.Status'.
Invalid column name 'Message.Account'.
Invalid column name 'Message.Status'.
Invalid column name 'Mailboxes.BoxNumber'.
Invalid column name 'Message.Account'.
Invalid column name 'Message.Status'.
Invalid column name 'Message.Account'.
Invalid column name 'Message.Status'.
Any help would be appreciated.