 |
| SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

April 13th, 2006, 01:34 PM
|
|
Registered User
|
|
Join Date: Apr 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
asp / atlas
hi,
im trying to create a simple database with Atlas, everything seems ok, I enabled page editing so user(s) can edit on the fly. I have a field in my page called 'Complaints' where the data type is 'nvarchar(50)' . I want to be able to have this field able to contain a paragraph of two, Is this possible? I know when it exceeds 50 characters and I try to update the "Complaints" UI on the website (I have it editable) It will crash, so I guess my question is how do increase the characters allowable on this field?
If it cant be done this way does anyone know of a way to keep the format and maybe add some html tag that will display, maybe through a dropdown sticky note kind of deal for the information?
|
|

April 13th, 2006, 01:56 PM
|
|
Registered User
|
|
Join Date: Apr 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Can someone move this into an SQL thread, thanks and sorry for the double post.
|
|

April 13th, 2006, 02:25 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
Didn't we do this before?? I mean, you ask the exact same question without providing additional information.
If you need more than 50 characters, you need to increase the size of the column. If you need a lot of characters use text or next instead.
However, the error message you posted seems to suggest some other problem: a foreign key constraint or you have a required column and try to insert a NULL value.
Like I suggested earlier, you need to post your code and your database schema, and explain the basic design of your database.
HtH,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
|
|

April 17th, 2006, 08:11 AM
|
|
Registered User
|
|
Join Date: Apr 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Here is the Table Definition - changing Complaint to ntext didnt work for me by the way...
TaskId int Unchecked
Name nvarchar(50) Checked
Complaint nvarchar(50) Checked
Date smalldatetime Checked
Complete bit Checked
Below is the code for the page as well. The database is to collect complaints, dates are the important thing, and the complaint of course..I added a control to allow the user to switch between active complaints and completed ones. Let me know if more info is needed, thanks in advance...
<%@ Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="todo.aspx.cs" Inherits="todo" Title="SCBL - Confederation Bridge" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:LoginView ID="LoginView1" OnViewChanged="LoginView1_ViewChanged" runat="server" >
<LoggedInTemplate>
Welcome,
<asp:LoginName ID="LoginName1" runat="server" />
!-
<asp:LoginStatus ID="LoginStatus1" runat="server" LogoutAction="RedirectToLoginPage" />
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/ChangePassword.aspx">Change Password</asp:HyperLink>
</LoggedInTemplate>
<AnonymousTemplate>
You are not currently logged in.
</AnonymousTemplate>
</asp:LoginView>
<br />
<br />
<h2 style="text-align: left">Confederation Bridge Complaint list<br />
Status:<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True">
<asp:ListItem Value="false">Active</asp:ListItem>
<asp:ListItem Value="true">Completed</asp:ListItem>
</asp:DropDownList>
<img src="cblogo.png" /> </h2><asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="TaskId" DataSourceID="ObjectDataSource1" CellPadding="4" GridLines="None" ForeColor="#333333">
<Columns>
<asp:CommandField ShowEditButton="True" ShowSelectButton="True" ShowDeleteButton="True" />
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
<asp:BoundField DataField="Complaint" HeaderText="Complaint" SortExpression="Complaint" />
<asp:BoundField DataField="Date" HeaderText="Date" SortExpression="Date" />
<asp:CheckBoxField DataField="Complete" HeaderText="Complete" SortExpression="Complete" />
</Columns>
<FooterStyle BackColor="#5D7B9D" ForeColor="White" Font-Bold="True" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" BorderStyle="Solid" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" Width="300px" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" BorderWidth="950px" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
<EditRowStyle BackColor="#999999" />
</asp:GridView>
<h3>Insert New Complaint
<asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="125px" AutoGenerateRows="False" CellPadding="4" DataKeyNames="TaskId" DataSourceID="ObjectDataSource1" DefaultMode="Insert" ForeColor="#333333" GridLines="None">
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<CommandRowStyle BackColor="#E2DED6" Font-Bold="True" />
<EditRowStyle BackColor="#999999" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<Fields>
<asp:BoundField DataField="TaskId" HeaderText="TaskId" InsertVisible="False" ReadOnly="True"
SortExpression="TaskId" />
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
<asp:BoundField DataField="Complaint" HeaderText="Complaint" SortExpression="Complaint" />
<asp:BoundField DataField="Date" HeaderText="Date" SortExpression="Date" />
<asp:CheckBoxField DataField="Complete" HeaderText="Complete" SortExpression="Complete" />
<asp:CommandField ShowInsertButton="True" />
</Fields>
<FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:DetailsView>
</h3>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="Delete"
InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" SelectMethod="GetTodoByStatus"
TypeName="todoTableAdapters.todoTableAdapter" UpdateMethod="Update">
<DeleteParameters>
<asp:Parameter Name="Original_TaskId" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="Name" Type="String" />
<asp:Parameter Name="Complaint" Type="String" />
<asp:Parameter Name="Date" Type="DateTime" />
<asp:Parameter Name="Complete" Type="Boolean" />
<asp:Parameter Name="Original_TaskId" Type="Int32" />
</UpdateParameters>
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" Name="IsComplete" PropertyName="SelectedValue"
Type="Boolean" />
</SelectParameters>
<InsertParameters>
<asp:Parameter Name="Name" Type="String" />
<asp:Parameter Name="Complaint" Type="String" />
<asp:Parameter Name="Date" Type="DateTime" />
<asp:Parameter Name="Complete" Type="Boolean" />
</InsertParameters>
</asp:ObjectDataSource>
</asp:Content>
|
|

April 19th, 2006, 01:52 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
One thing that just popped up: Is the TaskId an identity and an Autonumber field in SQL Server?
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
While typing this post, I was listening to: Not Here by Kane (Track 7 from the album: As Long As You Want This) What's This?
|
|
 |