Is there any particular reason why I am getting:
String or binary data would be truncated.
The statement has been terminated
After doing TIO 1204?
I followed instructions...here is the code for the page:
(Note..there's some extra debugging items--I added another calendar control to see if it was in how calendar was returning the date--doesn't appear so)
<%@ Page Language="
VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Protected Sub Calendar2_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs)
Response.Write(Calendar2.SelectedDate)
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DetailsView ID="DetailsView1" runat="server" AllowPaging="True" AutoGenerateRows="False"
DataKeyNames="emp_id" DataSourceID="DataSource1" Height="50px" Width="296px">
<Fields>
<asp:BoundField DataField="emp_id" HeaderText="emp_id" ReadOnly="True" SortExpression="emp_id" />
<asp:BoundField DataField="minit" HeaderText="minit" SortExpression="minit" />
<asp:BoundField DataField="lname" HeaderText="lname" SortExpression="lname" />
<asp:TemplateField HeaderText="hire_date" SortExpression="hire_date">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("hire_date") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:Calendar ID="Calendar1" runat="server" SelectedDate='<%# Bind("hire_date") %>'>
</asp:Calendar>
</InsertItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("hire_date") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="fname" HeaderText="fname" SortExpression="fname" />
<asp:CommandField ShowInsertButton="True" ShowEditButton="True" />
</Fields>
</asp:DetailsView>
<asp:SqlDataSource ID="DataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MdfPubs %>"
DeleteCommand="DELETE FROM [employee] WHERE [emp_id] = @emp_id" InsertCommand="INSERT INTO [employee] ([emp_id], [minit], [lname], [hire_date], [fname]) VALUES (@emp_id, @minit, @lname, @hire_date, @fname)"
SelectCommand="SELECT [emp_id], [minit], [lname], [hire_date], [fname] FROM [employee]"
UpdateCommand="UPDATE [employee] SET [minit] = @minit, [lname] = @lname, [hire_date] = @hire_date, [fname] = @fname WHERE [emp_id] = @emp_id">
<DeleteParameters>
<asp:Parameter Name="emp_id" Type="String" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="minit" Type="String" />
<asp:Parameter Name="lname" Type="String" />
<asp:Parameter Name="hire_date" Type="DateTime" />
<asp:Parameter Name="fname" Type="String" />
<asp:Parameter Name="emp_id" Type="String" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="emp_id" Type="String" />
<asp:Parameter Name="minit" Type="String" />
<asp:Parameter Name="lname" Type="String" />
<asp:Parameter Name="hire_date" Type="DateTime" />
<asp:Parameter Name="fname" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
<asp:Calendar ID="Calendar2" runat="server" OnSelectionChanged="Calendar2_SelectionChanged"></asp:Calendar>
</div>
</form>
</body>
</html>