Sythe.Org Forums     Register     FAQ     Members List     Calendar     Mark Forums Read    
 
Sythe.Org Forums  
   Runescape Gold

Sythe.org — A Virtual Goods Trading Hub

Make real cash! buying and selling in-game items.

We have a no-scam policy.

You can make thousands playing your favourite games here at Sythe.org.

Just sign up an account and follow the rules!


Take me to

Runescape Markets

Other Game Markets

Support Center

Register an Account

Close
How do i use new line or tab in sql DB with visual basic 2010
Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 07-19-2012, 03:40 AM
Newcomer
 
Join Date: Mar 2009
Posts: 8
Default How do i use new line or tab in sql DB with visual basic 2010

Hi, I would like to insert table of contents into the DB and show it in form with only 1 label. All text are in one field of database only. The text should include new lines.
something like:
------------------
"Table of Contents

Introduction
Background tabgoeshere 2-1
Objective tabgoeshere 2-2
"
------------------

I am using varchar(max) and this is what i got so far..



TIA

Last edited by LymX : 07-19-2012 at 04:19 AM.
Reply With Quote
  #2  
Old 07-23-2012, 06:23 PM
Blupig's Avatar
i am a guy ok?? -.-
Ex-Moderator Zombie Visual Basic Programmers
 
Join Date: Nov 2006
Location: Canada
Posts: 5,232
Send a message via MSN to Blupig Send a message via Skype™ to Blupig
MushyMuncher
Default Re: How do i use new line or tab in sql DB with visual basic 2010

Use vbCrLf
__________________
Reply With Quote
  #3  
Old 07-25-2012, 12:09 AM
Swan's Avatar
When They Cry...
Ex-Moderator
 
Join Date: Jan 2007
Location: Japan
Posts: 4,404
Default Re: How do i use new line or tab in sql DB with visual basic 2010

Use escape characters; characters preceded by a backslash that have a specific function.

For newline, the escape character is '\n' - Just insert it where you want a newline. As for tabspace, it's '\t'. Well, I'm speaking as a C programmer but I should assume VB will accept it being part of .Net.

Here's a list of them for you: http://msdn.microsoft.com/en-us/library/h21280bw.aspx
__________________
Quote:
[14:54:13] <&Filefragg> x9 is made of 5 glow in the dark gorilla dildos vibrating in unison.
[14:54:19] <%TDD> hot
[14:54:22] <+Aoi> Win
[14:54:23] <x9> I TOLD YOU NOT TO TELL ANYONE, DAMNIT
Reply With Quote
  #4  
Old 07-26-2012, 07:47 AM
Blupig's Avatar
i am a guy ok?? -.-
Ex-Moderator Zombie Visual Basic Programmers
 
Join Date: Nov 2006
Location: Canada
Posts: 5,232
Send a message via MSN to Blupig Send a message via Skype™ to Blupig
MushyMuncher
Default Re: How do i use new line or tab in sql DB with visual basic 2010

Quote:
Originally Posted by Swan View Post
Use escape characters; characters preceded by a backslash that have a specific function.

For newline, the escape character is '\n' - Just insert it where you want a newline. As for tabspace, it's '\t'. Well, I'm speaking as a C programmer but I should assume VB will accept it being part of .Net.

Here's a list of them for you: http://msdn.microsoft.com/en-us/library/h21280bw.aspx
To my knowledge VB doesn't accept them because it has its own set of characters, like vbTab, vbCr, vbLf, vbNewLine, etc.
__________________
Reply With Quote
  #5  
Old 07-26-2012, 09:38 PM
mercatres's Avatar
Apprentice
 
Join Date: Mar 2008
Location: Belgium
Posts: 675
Send a message via Skype™ to mercatres
Default Re: How do i use new line or tab in sql DB with visual basic 2010

Try using nvarchar or text.
What database are you using? MSSQL?
NCHAR(13) is a MSSQL command that should return an enter.

However I use MySQL and it stores it just fine.
__________________
I make private osrs scripts for tribot - PM me

Reply With Quote
  #6  
Old 07-27-2012, 01:57 AM
Blupig's Avatar
i am a guy ok?? -.-
Ex-Moderator Zombie Visual Basic Programmers
 
Join Date: Nov 2006
Location: Canada
Posts: 5,232
Send a message via MSN to Blupig Send a message via Skype™ to Blupig
MushyMuncher
Default Re: How do i use new line or tab in sql DB with visual basic 2010

Quote:
Originally Posted by mercatres View Post
Try using nvarchar or text.
What database are you using? MSSQL?
NCHAR(13) is a MSSQL command that should return an enter.

However I use MySQL and it stores it just fine.
Yeah this should work if you're executing your queries right away. If you're assembling them as strings though, use vbCrLf.
__________________
Reply With Quote
  #7  
Old 07-27-2012, 05:39 AM
Swan's Avatar
When They Cry...
Ex-Moderator
 
Join Date: Jan 2007
Location: Japan
Posts: 4,404
Default Re: How do i use new line or tab in sql DB with visual basic 2010

Quote:
Originally Posted by Blupig View Post
To my knowledge VB doesn't accept them because it has its own set of characters, like vbTab, vbCr, vbLf, vbNewLine, etc.
I thought that may be the case but I haven't used VB in a long time. I'd wonder about it though because it's a part of .Net so it may be capable of parsing escape chars.
__________________
Quote:
[14:54:13] <&Filefragg> x9 is made of 5 glow in the dark gorilla dildos vibrating in unison.
[14:54:19] <%TDD> hot
[14:54:22] <+Aoi> Win
[14:54:23] <x9> I TOLD YOU NOT TO TELL ANYONE, DAMNIT
Reply With Quote
  #8  
Old 07-27-2012, 06:31 PM
Blupig's Avatar
i am a guy ok?? -.-
Ex-Moderator Zombie Visual Basic Programmers
 
Join Date: Nov 2006
Location: Canada
Posts: 5,232
Send a message via MSN to Blupig Send a message via Skype™ to Blupig
MushyMuncher
Default Re: How do i use new line or tab in sql DB with visual basic 2010

Quote:
Originally Posted by Swan View Post
I thought that may be the case but I haven't used VB in a long time. I'd wonder about it though because it's a part of .Net so it may be capable of parsing escape chars.
I didn't actually test it before, but I suppose it doesn't work after seeing this:

__________________
Reply With Quote
  #9  
Old 07-29-2012, 02:04 PM
Yenthe666's Avatar
Apprentice
$5 USD Donor New
 
Join Date: Apr 2011
Posts: 887
Send a message via Skype™ to Yenthe666
St. Patrick's Day 2013
Default Re: How do i use new line or tab in sql DB with visual basic 2010

Hmm strange it doesn't accept. I only code in visual studio 2010 so meh.
Try: "\n" if that really doesn't work you could also try
Environment.NewLine;
__________________



Thanks to Exapto for it! ^
Scammers banned: 4.
Reply With Quote
  #10  
Old 07-31-2012, 04:07 AM
Newcomer
 
Join Date: Mar 2009
Posts: 8
Default Re: How do i use new line or tab in sql DB with visual basic 2010

Hey guys thanks for the replies. The problem is because i copy the data from a notepad and insert it directly to the database (service based database) and when i paste it the database doesn't accept new line but when i made a richtextbox paste the data in there and save it to database it worked. Thanks guys.
Reply With Quote
Reply



Cheap RS Gold Store  Runescape Gold

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

All times are GMT +1. The time now is 10:48 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.6.1