Multi-Line TextBox writting to Sql Server

Discussion in 'ASP .Net' started by John Carnahan, May 27, 2004.

  1. I have a problem writing the text from a multi-line textbox to the Sql
    Server db.
    If the user sends a vbcrlf (enter key) in the middle of the entered text,
    the text gets
    truncated at the vbcrlf when writting the data to the database. The text
    could get rather long.


    The dataset has all of the text (including the vbcrlf), but the resulting
    table field in the database only ends up with the portion of text before the
    vbcrlf.

    I'm use a sql dataadapter with a parameter for the insert and update
    commands
    SqlParameter("@Plan2", System.Data.SqlDbType.NVarChar, 1000, "Plan2"))

    and the table is nvarchar(1000). The typed dataset xml shows as a string.

    <xs:element name="Plan2" type="xs:string" minOccurs="0" />

    Do I need to strip out the Vbcrlf from the datset field before issuing the
    update? or is there something else I could do?

    I'm sure the users will hit the Enter Key in the textbox, so what ever I do
    needs to be behind the scenes.

    Thanks,

    John
     
    John Carnahan, May 27, 2004
    #1
    1. Advertising

  2. I apologize if this insults your intelligence.

    Are you trying to look at the table through enterprise manager. If so, then
    it will only show you one line at a time, you will have to scroll down the
    cell to see the rest.

    If you look at it through query analyzer, it will show all the data in one
    line with extra spaces.

    HTH,

    bill


    "John Carnahan" <> wrote in message
    news:...
    > I have a problem writing the text from a multi-line textbox to the Sql
    > Server db.
    > If the user sends a vbcrlf (enter key) in the middle of the entered text,
    > the text gets
    > truncated at the vbcrlf when writting the data to the database. The text
    > could get rather long.
    >
    >
    > The dataset has all of the text (including the vbcrlf), but the resulting
    > table field in the database only ends up with the portion of text before

    the
    > vbcrlf.
    >
    > I'm use a sql dataadapter with a parameter for the insert and update
    > commands
    > SqlParameter("@Plan2", System.Data.SqlDbType.NVarChar, 1000, "Plan2"))
    >
    > and the table is nvarchar(1000). The typed dataset xml shows as a string.
    >
    > <xs:element name="Plan2" type="xs:string" minOccurs="0" />
    >
    > Do I need to strip out the Vbcrlf from the datset field before issuing the
    > update? or is there something else I could do?
    >
    > I'm sure the users will hit the Enter Key in the textbox, so what ever I

    do
    > needs to be behind the scenes.
    >
    > Thanks,
    >
    > John
    >
    >
    >
     
    William F. Robertson, Jr., May 27, 2004
    #2
    1. Advertising

  3. You didn't insult my intelligence... I'm thinking I don't have any to
    insult!
    Actually, I was querying the table after the insert, and the data was
    truncated. I did a little routine that strips out the vbcrlf's
    and it works ok now. I'm sure there is a better solution to this, but it
    seems to work. I used a StringReader to readLine() the
    string into a new string, and then stuffed that into the dataset before
    saving it to the database. The readLine strips out the vbcrlf's.
    If you have a better way to do this, please shout.
    Thanks,
    John

    "William F. Robertson, Jr." <> wrote in message
    news:...
    > I apologize if this insults your intelligence.
    >
    > Are you trying to look at the table through enterprise manager. If so,

    then
    > it will only show you one line at a time, you will have to scroll down the
    > cell to see the rest.
    >
    > If you look at it through query analyzer, it will show all the data in one
    > line with extra spaces.
    >
    > HTH,
    >
    > bill
    >
    >
    > "John Carnahan" <> wrote in message
    > news:...
    > > I have a problem writing the text from a multi-line textbox to the Sql
    > > Server db.
    > > If the user sends a vbcrlf (enter key) in the middle of the entered

    text,
    > > the text gets
    > > truncated at the vbcrlf when writting the data to the database. The text
    > > could get rather long.
    > >
    > >
    > > The dataset has all of the text (including the vbcrlf), but the

    resulting
    > > table field in the database only ends up with the portion of text before

    > the
    > > vbcrlf.
    > >
    > > I'm use a sql dataadapter with a parameter for the insert and update
    > > commands
    > > SqlParameter("@Plan2", System.Data.SqlDbType.NVarChar, 1000, "Plan2"))
    > >
    > > and the table is nvarchar(1000). The typed dataset xml shows as a

    string.
    > >
    > > <xs:element name="Plan2" type="xs:string" minOccurs="0" />
    > >
    > > Do I need to strip out the Vbcrlf from the datset field before issuing

    the
    > > update? or is there something else I could do?
    > >
    > > I'm sure the users will hit the Enter Key in the textbox, so what ever I

    > do
    > > needs to be behind the scenes.
    > >
    > > Thanks,
    > >
    > > John
    > >
    > >
    > >

    >
    >
     
    John Carnahan, May 28, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark
    Replies:
    4
    Views:
    10,166
    Sonali.NET[MVP]
    Aug 4, 2003
  2. Chad Z. Hower aka Kudzu
    Replies:
    1
    Views:
    705
  3. =?Utf-8?B?Wlo=?=

    number of lines of TextBox in Multi-line mode

    =?Utf-8?B?Wlo=?=, Jun 28, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    766
    Carl Prothman [MVP]
    Jun 28, 2004
  4. mosscliffe
    Replies:
    1
    Views:
    3,500
    Arsalan
    Apr 28, 2006
  5. hongky

    i am writting a mail server with C

    hongky, Oct 8, 2003, in forum: C Programming
    Replies:
    1
    Views:
    294
    Dick Poon
    Oct 8, 2003
Loading...

Share This Page