Posted on 2009-06-27
I have a gridview with an sqldatasource as follows:
<asp:SqlDataSource ID="SqlDataSourceLocationList" runat="server"
ConnectionString="<%$ ConnectionStrings:SOME_DSN %>"
SelectCommand="select (FName + '.' + LName) as ContactName, C.Email, P.Phonenumber, P.LocationGuid from ClientLogin C, Phones P Where C.PhoneNumberGuid=P.PhoneNumberGuid and C.ClientGuid=@pClientGUID"
<asp:SessionParameter Name="pClientGUID" Direction="Input" SessionField="SessionInfo.ClientGUID" Size="36" />
On page load and unload I keep passing a class called "SessionInfo" that I manipulate and store/load. I pass the ClientGuid as SessionInfo and cast it to my class type and access the various properties...
The associated grid comes back with 0 rows and I know that for the clientguid passed to the page via a session variable, there should be one row returned and have run the sql in management studio express.
Also note that the ClientGuid is of type uniqueidentifier. And that when I remove the parameter ( "and C.ClientGuid=@pClientGUID" ) and return all the table rows, the grid populates with data.
It might have to do with the Session