kanuri1 -2 Junior Poster in Training

help me please...........
here iam writing code for client side validations.......
but the code is not properly working.....
it will not show any error messages.......
here my code is given below.....
iam working asp.net with vb.net
sql server database.....
please check my code and give me the correct code...........

Protected Sub roomno_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles roomno.SelectedIndexChanged
 Dim conn As New SqlConnection(ConfigurationManager.ConnectionStrings("guest1").ConnectionString())
   
		Try
			conn.Open()
			Dim dr As System.Data.SqlClient.SqlDataReader
			Dim da As New SqlClient.SqlCommand("select room_no from guesthouse  WHERE room_no =  '" & roomno.SelectedItem.Text & "' and status <> 'C'", conn)
			dr = da.ExecuteReader
			If dr.Read() Then
				Page.ClientScript.RegisterStartupScript(Me.GetType(), "alert", "<script language=JavaScript>alert('" & "this room is booked from " & dr(0).ToString().Substring(0).Remove(10) & " to " & dr(1).ToString().Substring(0).Remove(10) & ".so this room is available from  the date " & dr(1).ToString().Substring(0).Remove(10) & " onwards! " & "');</script>")
			End If
		Catch ex As Exception
			conn.Close()
		End Try

	End Sub

<asp:DropDownList ID="roomno" runat="server" Style="z-index: 103; left: 171px;
            position: absolute; top: 140px" Width="133px" Height="30px" AutoPostBack="True">
                    <asp:ListItem>1</asp:ListItem>
                    <asp:ListItem>2</asp:ListItem>
                    <asp:ListItem>3</asp:ListItem>
                    <asp:ListItem>4</asp:ListItem>
                    <asp:ListItem>5</asp:ListItem>
                    <asp:ListItem>6</asp:ListItem>
                    <asp:ListItem>7</asp:ListItem>
                    <asp:ListItem>8</asp:ListItem>
                    <asp:ListItem>9</asp:ListItem>
                    <asp:ListItem>10</asp:ListItem>
        </asp:DropDownList>&nbsp;</td>

please help me 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.