VBdotnet2005
asked on
form strings
sample " Dim theVar = New List(Of String) From { "one", "two", "three" }
I don't know strings in advance. However, I want to be able to pass like below sample.
Dim mystring as as string = "one", "two", "three"
Dim theVar = New List(Of String) From { mystring }
What is the right way to form mystring variable? Is this possible?
I don't know strings in advance. However, I want to be able to pass like below sample.
Dim mystring as as string = "one", "two", "three"
Dim theVar = New List(Of String) From { mystring }
What is the right way to form mystring variable? Is this possible?
Hi VBdotnet2005;
This is incorrect string format statement.
Dim mystring as as string = "one", "two", "three"
Did you mean this?
Dim mystring As String = "one, two, three"
If so then this will work.
This is incorrect string format statement.
Dim mystring as as string = "one", "two", "three"
Did you mean this?
Dim mystring As String = "one, two, three"
If so then this will work.
Dim mystring As String = "one, two, three"
Dim theVar As List(Of String) = mystring.Split(New Char() { ","C, " "C }, StringSplitOptions.RemoveEmptyEntries).ToList()
ASKER
Hi Fernando,
Did you see my link above?
XPCollection1.Filter = New InOperator("Name", New String() {"John", "Mike", "Nick"})
I don't know my string in advance. I want to pass like
dim mystring as string = form my string like "John", "Mike", "Nick"
XPCollection1.Filter = New InOperator("Name", New String() {mystring })
Did you see my link above?
XPCollection1.Filter = New InOperator("Name", New String() {"John", "Mike", "Nick"})
I don't know my string in advance. I want to pass like
dim mystring as string = form my string like "John", "Mike", "Nick"
XPCollection1.Filter = New InOperator("Name", New String() {mystring })
I saw it after I posted my post and was about to post you back when you updated.
So it looks like you need an Array of String's. So where are these keept before getting to this point?
{ "John", "Mike", "Nick" }
So it looks like you need an Array of String's. So where are these keept before getting to this point?
{ "John", "Mike", "Nick" }
ASKER
"So where are these keept before getting to this point?"
I am planing to return it from sql query. This is not a problem.
I am planing to return it from sql query. This is not a problem.
In order for someone to tell you how to get it into an Array we need to know how they are currently stored in memory. You state that you plan to return then in a SQL query. Is all the names in a single string returned from SQL? Is it in some collection being returned? Is Name the only column being returned or are there multiple columns being returned?
ASKER
"Is all the names in a single string returned from SQL?"
correct
correct
ASKER
I am sorry.
from sql
column Name
John
Mike
Nick
I want to return like "john", "mike", "Nick" as a single string.
from sql
column Name
John
Mike
Nick
I want to return like "john", "mike", "Nick" as a single string.
Let try it this way please post the actual SQL query and the code you are actually using to call the database.
ASKER
I don't have a problem calling sql or returning result. I can return it like from sql using datareader.
Dim sr As SqlDataReader = sqlcomm.ExecuteReader
Dim name_str As New List(Of String)
while sr.read
name_str.add(sr.item("name ")
end while
Now name_str should contains
John
Mike
Nick
How can I form this as a single string "John", "Mike", "Nick" ?
Dim sr As SqlDataReader = sqlcomm.ExecuteReader
Dim name_str As New List(Of String)
while sr.read
name_str.add(sr.item("name
end while
Now name_str should contains
John
Mike
Nick
How can I form this as a single string "John", "Mike", "Nick" ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Did that work out for you?
ASKER
yes, Thank you Fernando.
Not a problem VBdotnet2005, glad to help.
ASKER
XPCollection1.Filter = New InOperator("Name", New String() {"John", "Mike", "Nick"})