0

hi frnds,
when iam accessing the date ,,,it willshow both date and aswell as default time.
iam only accessing the date,,,,,
here my coding is given below........

<asp:GridView ID="GridView1" runat="server" BackColor="White" BorderColor="#CC9966"
            BorderStyle="None" BorderWidth="1px" CellPadding="4" DataSourceID="SqlDataSource1"
            Style="z-index: 103; left: 288px; position: absolute; top: 256px" AutoGenerateColumns="False">
            <RowStyle BackColor="White" ForeColor="#330099" />
            <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
            <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
            <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" />
            <Columns>
                <asp:BoundField DataField="Expr1" HeaderText="Expr1" ReadOnly="True" SortExpression="Expr1" />
                <asp:BoundField DataField="Expr2" HeaderText="Expr2" SortExpression="Expr2" />
                <asp:BoundField DataField="DAYS" HeaderText="DAYS" ReadOnly="True" SortExpression="DAYS" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:guest1 %>"
            SelectCommand="SELECT CONVERT (DateTime, date_of_arr, 103) AS Expr1, CONVERT (DateTime, date_of_dept, 103) AS Expr2, DATEDIFF(dd, date_of_arr, date_of_dept) AS DAYS FROM guesthouse WHERE (CONVERT (DateTime, date_of_arr, 103) = @date_of_arr)">
            <SelectParameters>
                <asp:ControlParameter ControlID="arrivaldate" Name="date_of_arr" PropertyName="Text" />
            </SelectParameters>
        </asp:SqlDataSource>

here iam using asp.net with vb.net and database is sqlserver2005.........
pls give me the code...........

Edited by nav33n: Use [code] tags for easy readability.

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by mail2saion
0

Try this (add the red part):

<asp:GridView ID="GridView1" runat="server" BackColor="White" BorderColor="#CC9966"
            BorderStyle="None" BorderWidth="1px" CellPadding="4" DataSourceID="SqlDataSource1"
            Style="z-index: 103; left: 288px; position: absolute; top: 256px" AutoGenerateColumns="False">
            <RowStyle BackColor="White" ForeColor="#330099" />
            <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
            <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
            <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" />
            <Columns>
                <asp:BoundField DataField="Expr1" HeaderText="Expr1" ReadOnly="True" SortExpression="Expr1" DataFormatString="{0:d}" HtmlEncode=False />
                <asp:BoundField DataField="Expr2" HeaderText="Expr2" SortExpression="Expr2" DataFormatString="{0:d}" HtmlEncode=False />
                <asp:BoundField DataField="DAYS" HeaderText="DAYS" ReadOnly="True" SortExpression="DAYS" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:guest1 %>"
            SelectCommand="SELECT CONVERT (DateTime, date_of_arr, 103) AS Expr1, CONVERT (DateTime, date_of_dept, 103) AS Expr2, DATEDIFF(dd, date_of_arr, date_of_dept) AS DAYS FROM guesthouse WHERE (CONVERT (DateTime, date_of_arr, 103) = @date_of_arr)">
            <SelectParameters>
                <asp:ControlParameter ControlID="arrivaldate" Name="date_of_arr" PropertyName="Text" />
            </SelectParameters>
        </asp:SqlDataSource>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.