kanuri1 -2 Junior Poster in Training

hi
i want to show the grid view in another web page when button is clicked,,,,,
here iam using sqlserver-2005,
here my code is given below

Protected Sub chkavail_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles chkavail.Click
        Dim a As String
        Dim b As Boolean
        Dim dr As System.Data.SqlClient.SqlDataReader
        Dim conn As New SqlConnection(ConfigurationManager.ConnectionStrings("guest1").ConnectionString())
        conn.Open()
        Dim command As New SqlCommand("select room_no as 'ROOM NO', convert(varchar,date_of_arr ,103) as 'ARRIVALDATE' , convert(varchar,date_of_dept,103) as 'DEPARTUREDATE',convert(varchar(10),datediff(dd,date_of_arr,date_of_dept) ,103) as 'DAYS' from guesthouse ", conn)
        dr = command.ExecuteReader
        b = False
        If (dateofarrival.Text = "") Then
            b = True
            MsgBox("enter the date of arrival  first")
        Else
            Try
                a = dateofarrival.Text
                While dr.Read()
                    If (a = dr(2)) Then
                        b = True
                        dr.Close()
                        conn.Close()
                        Response.Redirect("check availability.aspx")
                        Exit While
                    End If
                End While
            Catch ex As FormatException
                b = True
            End Try
        End If
        dr.Dispose()
        conn.Dispose()
        dr.Close()
        conn.Close()



    End Sub
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.