Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Working with String in .NET
WhatsApp
Kishan Tanpure
Sep 18
2014
3
k
0
0
'Store sql query value into a list of string myListOfStrings
Dim
myListOfStrings
As
New
List(Of
String
)
Dim
conStr =
"write your connection string here"
Using connection
As
New
SqlConnection(conStr )
Dim
sql
As
String
=
"write your sql query here"
Dim
command
As
New
SqlCommand(sql, connection)
Using reader
As
SqlDataReader = command.ExecuteReader()
While
reader.Read()
myListOfStrings.Add(reader(
"column_name"
))
End
While
End
Using
End
Using
'Convert List of String to a String separated by a comma(,) delimiter
String
.Join(
","
, myListOfStrings.ToArray())
vb.net
List
string in .net
Up Next
Working with String in .NET