I am very sorry. I didn't know anything about thread jacking. I will be more careful about it.
I have create a new webpage with new coding and a little reference from your coding. I think i have found the problem for my coding. The problem is converting the DateTime from .NET to MSSQL. This is my coding for now.
Webpage Coding
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1"
EmptyDataText="There are no data records to display." AllowPaging="True"
AllowSorting="True">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="StaffSelector" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="StaffNo" HeaderText="StaffNo"
SortExpression="StaffNo" />
<asp:BoundField DataField="FirstName" HeaderText="FirstName"
SortExpression="FirstName" />
<asp:BoundField DataField="LastName" HeaderText="LastName"
SortExpression="LastName" />
<asp:BoundField DataField="RolesName" HeaderText="RolesName"
SortExpression="RolesName" />
<asp:BoundField DataField="Status" HeaderText="Status"
SortExpression="Status" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MilanDatabaseConnectionString1 %>"
ProviderName="<%$ ConnectionStrings:MilanDatabaseConnectionString1.ProviderName %>"
SelectCommand="SELECT StaffAvailability.StaffNo, StaffProfile.FirstName, StaffProfile.LastName, StaffProfile.RolesName, StaffProfile.Status FROM StaffAvailability INNER JOIN StaffProfile ON StaffAvailability.StaffNo = StaffProfile.StaffNo WHERE (StaffProfile.Status = 'Free') AND (StaffProfile.RolesName LIKE '%' + @RolesName + '%') AND (StaffAvailability.AvailabilityDate NOT IN (@AvailabilityDate))">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" Name="RolesName"
PropertyName="SelectedValue" />
<asp:ControlParameter ControlID="TextBox1" Name="AvailabilityDate"
PropertyName="Text" />
</SelectParameters>
</asp:SqlDataSource>
<table>
<tr>
<td colspan="2">
Search Appointment<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</td>
</tr>
<tr>
<td>
Search Appointment Date</td>
<td>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
Select Staff Categories</td>
<td>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True">
<asp:ListItem></asp:ListItem>
<asp:ListItem>Photographer</asp:ListItem>
<asp:ListItem>Designer</asp:ListItem>
<asp:ListItem>Stylist</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
</table>
<br />
<br />
<br />
<table>
<tr>
<td>
Invoice Number</td>
<td>
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
Appointment Type</td>
<td>
<asp:DropDownList ID="DropDownList2" runat="server">
<asp:ListItem></asp:ListItem>
<asp:ListItem>Indoor
</asp:ListItem>
<asp:ListItem>Outdoor</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
Venue</td>
<td>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
</td>
<td>
<asp:Button ID="Button2" runat="server" Text="Button" />
</td>
</tr>
</table>
Inside Coding
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
SqlDataSource1.InsertCommandType = SqlDataSourceCommandType.StoredProcedure
SqlDataSource1.InsertCommand = "AddStaffAvailability"
Dim i As Integer = 0
For Each item As GridViewRow In GridView1.Rows
If CType(item.FindControl("StaffSelector"), CheckBox).Checked = True Then
Dim staffNo As String = item.Cells(1).Text
Dim orderNo As String = "INV001"
Dim venueName As String = "Milan"
Dim dataname As DateTime = Convert.ToDateTime("1/1/2009 12:00:00 AM")
SqlDataSource1.InsertParameters.Add("StaffNo", staffNo)
SqlDataSource1.InsertParameters.Add("OrderNo", orderNo)
SqlDataSource1.InsertParameters.Add("AvailabilityDate", dataname)
SqlDataSource1.InsertParameters.Add("AppointmentType", DropDownList2.SelectedValue)
SqlDataSource1.InsertParameters.Add("Venue", "Milan")
i = i + 1
End If
Next
Dim rowAffected As Integer = 0
Try
SqlDataSource1.Insert()
Catch ex As Exception
Label1.Text = "Work More<br/>" & ex.Message
Finally
End Try
If rowAffected <> i Then
Label1.Text = "Almost There"
Else
Label1.Text = "Success"
End If
End Sub