I am using ajax calender exterder to pick date and month to my database , but some how , i cant bind the calender externder to my database
i got this error :
String was not recognized as a valid DateTime.
here is my code ,can you help me out ?
<cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></cc1:ToolkitScriptManager> Select Date:<asp:TextBox ID="DateQualifiedTextBox" Text='<%#Bind("DateQualified" , "{0: MM/dd/yyyy}") %>' runat="server" ReadOnly="true" Height="21px" Width="200px" ></asp:TextBox> <asp:ImageButton ID="imgPopup" runat="server" ImageAlign="Bottom"
ImageUrl="images/calendar.png" /><cc1:CalendarExtender ID="DateQualifiedTextBox_CalendarExtender" runat="server" Format="dd/MM/yyyy"
PopupButtonID="imgPopup" TargetControlID="DateQualifiedTextBox"></cc1:CalendarExtender>Dim dt As DateTime = DateTime.ParseExact(DateQualifiedTextBox.Text, "dd/MM/yyyy", Nothing).ToString("MM/dd/yyyy")
Dim connectionString As String = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString
Dim insertSql As String = "INSERT INTO Tbbooking(Date) VALUES(@Date)"
Using myConnection As New SqlConnection(connectionString)
myConnection.Open()
Dim myCommand As New SqlCommand(insertSql, myConnection)
myCommand.Parameters.AddWithValue("@Date", dt)
myCommand.ExecuteNonQuery()
myConnection.Close()
Response.Redirect("Confirmation.aspx")
End Using