kanuri1 -2 Junior Poster in Training

hi frnds,
when iam accessing the data from database in mm/dd/yyyy format and displaying in gridview it is possible to acesss,,,,,,,,,,but when iam accessing the data wsing date in dd/mm/yyyy format it doesn't show any data and gives error as

"Arithmetic overflow error converting expression to data type datetime."

but iam storing the data in the database in mm/dd/yyyy formt.......

pls help me how to save the data in the database as like dd/mm/yyyy formt ........
here my insert query is....

"insert into guesthouse(booking_no,date_of_arr,year,name,desig,dept,addr,room_no,no_beds,time_of_arr,date_of_dept,amt,remarks,prior_booking,booked_by,booking_date) values('" & booking_no & "' ,CONVERT(datetime ,'" & date_of_arr & "', 103),CONVERT(datetime.today.now.year ,'" & year & "'),'" & name & "','" & desig & "','" & dept & "' ,'" & addr & "', '" & room_no & "','" & no_beds & "','" & time_of_arr & "',CONVERT(datetime ,'" & date_of_dept & "', 103),'" & amt & "','" & remarks & "','" & prior_booking & "','" & booked_by & "',CONVERT(datetime ,'" & booking_date & "', 103))"

and

grid view coding is as follows........

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BackColor="White"
        BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px" CellPadding="4" DataSourceID="SqlDataSource1"
        Style="z-index: 104; left: 364px; position: absolute; top: 268px">
        <RowStyle BackColor="White" ForeColor="#330099" />
        <Columns>
            <asp:BoundField DataField="ARRIVALDATE" HeaderText="ARRIVALDATE" ReadOnly="True"
                SortExpression="ARRIVALDATE"
                DataFormatString="{0:d}" HtmlEncode=False  />
            <asp:BoundField DataField="DEPARTUREDATE" HeaderText="DEPARTUREDATE" SortExpression="DEPARTUREDATE" 
            DataFormatString="{0:d}" HtmlEncode=False />
            <asp:BoundField DataField="DAYS" HeaderText="DAYS" ReadOnly="True" SortExpression="DAYS" />
        </Columns>
        <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" />
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:guest1 %>"
        SelectCommand="SELECT CONVERT (DateTime, date_of_arr, 103) AS ARRIVALDATE, CONVERT (DateTime, date_of_dept, 103) AS DEPARTUREDATE, 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........
database is sqlserver-2005...........
pls help me it is very urgent.............

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.