Click here to Skip to main content
15,885,882 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: , +
Hi All
I will appreciated if anyone can show me the issue in my code,because after inserting the query to my Griedview in vs 2012 using Access database it doesn't display anything
Here is my code
C#
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
         DataSourceID="AccessDataSource1" >
        
        <Columns>
            <asp:BoundField DataField="USER_NAME" HeaderText="USER_NAME" SortExpression="USER_NAME" />
            <asp:BoundField DataField="COURSE_CODE" HeaderText="COURSE_CODE" SortExpression="COURSE_CODE" />
            <asp:BoundField DataField="COURSE_NAME" HeaderText="COURSE_NAME" SortExpression="COURSE_NAME" />
        </Columns>
    </asp:GridView>
    <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/ASPNetDB.mdb" 
        SelectCommand="SELECT * FROM [studentenrolled] WHERE ([User_name] = ?)">
      
        <SelectParameters>
            <asp:SessionParameter Name="User_name" SessionField="User_name" />
        </SelectParameters>
    </asp:AccessDataSource>
</asp:Content>

Thank you
Posted
Updated 16-Feb-14 18:11pm
v3

1 solution

Make this, AutoGenerateColumns="True"

-KR
 
Share this answer
 
Comments
aa00101 16-Feb-14 23:22pm    
I did changed it to TRUE but nothing changed still having the same issue.
Krunal Rohit 16-Feb-14 23:30pm    
okay and what have you written in .aspx.cs page ?
-KR
aa00101 17-Feb-14 0:05am    
I don't have any code there, what i did is I made a query in my Access database then in my c# page I connected to this query and used the command and parameter in visual studio to use the select method <SelectParameters <asp:SessionParameter Name="USER_NAME" sessionField="USER_NAME" /> </SelectParameters>

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900