CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10
  1. #1
    Join Date
    Nov 2005
    Posts
    66

    Exclamation Multiline Textbox Using Query......

    Hi All,

    How to save multiline Textbox Using SQL Query .am saving using following SQL

    <Code> = <\code>
    SQL = " insert into Sitemaster (Srno,Site_name,Site_id,Bsc_id,Site_stru,Hub,Site_city,Dist_hq,Site_add )" & " values (" & txtsrno & ","
    SQL = SQL & "'" & txtsitename.Text & "','" & txtsiteid.Text & "','" & txtbscid.Text & "','" & txtsitestru.Text & "',"
    SQL = SQL & "'" & txthub.Text & "','" & txtsitecity.Text & "','" & txthq.Text & "','" & txtsiteadd.Text & "')"

    Txtsiteadd will multiline textbox
    but its saving only First line
    while other lines are not saving

    Appericiated Help

    Thanks
    Last edited by rajeshidea; January 17th, 2006 at 02:18 AM. Reason: spellmistake

  2. #2
    Join Date
    Nov 2005
    Posts
    36

    Re: Multiline Textbox Using Query......

    I know that in MS Access, when you set up a table, it has a max # of characters in will accept if you make it a text column.

    I had to make it a memo type, to actually allow more characters to go there.

    It shouldn't really be a problem with multi-lines, because this is just a visual thing. It is all really just one line, it's just "wrapped" to look like multiple lines.

    Give a little bit more information about where exactly you are saving this information

  3. #3
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: Multiline Textbox Using Query......

    Quote Originally Posted by rajeshidea
    Hi All,

    How to save multiline Textbox Using SQL Query .am saving using following SQL

    <Code> = <\code>
    SQL = " insert into Sitemaster (Srno,Site_name,Site_id,Bsc_id,Site_stru,Hub,Site_city,Dist_hq,Site_add )" & " values (" & txtsrno & ","
    SQL = SQL & "'" & txtsitename.Text & "','" & txtsiteid.Text & "','" & txtbscid.Text & "','" & txtsitestru.Text & "',"
    SQL = SQL & "'" & txthub.Text & "','" & txtsitecity.Text & "','" & txthq.Text & "','" & txtsiteadd.Text & "')"

    Txtsiteadd will multiline textbox
    but its saving only First line
    while other lines are not saving

    Appericiated Help

    Thanks
    As lready suggested by Buddy008, change the Field's Data type to Memo. In your case the field that needs to be changed is Site_add

    ps: Follow the link in my signature on how to use Code Tags while posting Source Code.

  4. #4
    Join Date
    Jan 2001
    Posts
    486

    Re: Multiline Textbox Using Query......

    When you say "Txtsiteadd will multiline textbox", do you mean that the data in that textbox is in multiple lines? If so, you will need to get rid of carriage return and/or line feed characters before using in you SQL statement.

    You could try something like this:

    Code:
    SQL = SQL & "'" & txthub.Text & "','" & txtsitecity.Text & "','" & txthq.Text & "','" & Replace(txtsiteadd.Text, vbCrLf, " ") & "')"
    If kids were left to their own devices, would they ever come up with a thing like war?......The Wheel / Todd Rundgren

    Do canibals not eat clowns because they taste funny?

  5. #5
    Join Date
    Jan 2010
    Posts
    24

    Re: Multiline Textbox Using Query......

    Its check each character’s ASCII value entered into the textbox, so when the enter key is pressed its also check the ASCII value and then it avoid to insert the carriage return value to the textbox. So we can avoid to insert Carriage Return into the textbox having “ Multiline” TextMode property or in TextArea control.

    <asp:TextBox ID="txtComments" Height="150" Columns="200" TextMode="multiline" MaxLength="4000" runat="server" onkeydown = "return (event.keyCode!=13);" />

    Note: ASCII value for Enter Key is 13.

    http://www.mindfiresolutions.com/Res...ontrol-535.php

  6. #6
    Join Date
    Jul 2006
    Location
    Germany
    Posts
    3,725

    Re: Multiline Textbox Using Query......

    Still reviving dead threads? Answer is 4 years late.

  7. #7
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: Multiline Textbox Using Query......

    Quote Originally Posted by WoF View Post
    Still reviving dead threads? Answer is 4 years late.
    And is incorrect. Access can handle multiline entries just fine I have quite a few of them in various databases and I have not stripped a single CRLF from them. Not to mention that it is ASP code instead of VB6
    Always use [code][/code] tags when posting code.

  8. #8
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Multiline Textbox Using Query......

    Multiline TB doesn't have VbCrLf to distinguish between lines. That's why it resizes
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  9. #9
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: Multiline Textbox Using Query......

    Not sure what you mean there. It is true that a multiline textbox can be set to word wrap depending on what your scroll bar settings are but it also works properly with the CRLF no matter what scroll mode it is in.
    Always use [code][/code] tags when posting code.

  10. #10
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Multiline Textbox Using Query......

    If you don't add them, there's no need to parse them out
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured