string to string[] #2

string[] strArray;while(dtardrUsrDet.Read()) 



string strUsrEmail=dtardrUsrDet.GetValue(0).ToString();

int intDayDiff=System.Convert.ToInt16(dtardrUsrDet.GetValue(1).ToString());













how to store string values from reader into string array

Mark As Answer If my reply helped you.
5/25/2007 10:10:15 AM 91979 articles. 4 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 55
Get it on Google Play
Get it on Apple App Store


I am assuming that you want each string in an array, not each character as a separate string in a string array here....

The easiest way is to create an ArrayList, add each string to that (within a while loop to read each record from the DataReader) and then use the ToArray() method, passing the type that you want the array to be (i.e string in your case).

In .net 2.0, you would use a generic List<string> collection, which gives you the advantage of strong typing on the collection.


Please mark any responses as Answers if they helped you solve your problem
5/25/2007 10:48:03 AM

string[] strArray;

Int i=0; 



string strUsrEmail=dtardrUsrDet.GetValue(0).ToString();

int intDayDiff=System.Convert.ToInt16(dtardrUsrDet.GetValue(1).ToString());

if(intDayDiff==45 || intDayDiff==30)


     Array.Resize(ref strArray, i);
strArray[i] = strUsrEmail;




hope this helps./. 

[KaushaL] || BloG || Profile || Microsoft MVP

"I would love to change the world, but they won’t give me the source code"

Don't forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and mark your thread as Resolved for the sake of Future Readers.
5/25/2007 12:54:01 PM

Similar Artilces:

String and string?
Hi guys, I was wondering the difference between small letter string type and a capital letter String type. Does anyone know about this? Highly appreciate for your answers! Thankz! The "proper" version is String, as it references the System.String class of the .NET Framework Class Library. The ability to use string is provided by C#, where it is an alias to String. Similarly, the "proper" version of an integer is Int32, as it references System.Int32.  The ability to use int is provided by C#, and the ability to use Integer is provided by VB.NET, and both int and Integer are aliases...

string to string[]
Hi, I've got this code : string[] Params; string SQL = "SELECT * FROM T_MANAGEMENT_PAGES"; SqlCommand myCommand = new SqlCommand(SQL, myConnection); myConnection.Open(); SqlDataReader myReader = myCommand.ExecuteReader(); try { while (myReader.Read()) { Params_Type = myReader.GetValue(0).ToString(); } } catch { } finally { } myReader.Close(); My problem is to obtain Params_Type. But each time, it says : "impossible to convert '[object]' in 'string[]' &quo...

string and string[]
hello, whats the difference here between string and string[] thanks "string" denotes an item of type String "string[]" denotes an array of type String itemsThanks, EdMicrosoft MVP - ASP/ASP.NET Gracia mon ami...

String and String[]
What will be the advantage of using myString: String[10] over myString: String Man wrote: > What will be the advantage of using > myString: String[10] > over > myString: String "String[10]" is a fixed-length, statically allocated, Ansi-based ShortString. "String" is a dynamic-length, dynamically allocated, reference counted, Ansi-based or Unicode-based (depening on Delphi version) Long string. Unless you absolutely need the static, fixed length nature of ShortString, such as in records that interact with external systems, you should stay ...

string() = string()
this code does not work (not instance of object) Dim Items(), Other() As String Items = New String() {"A","B","C"} Other = New String() {} Other = Items how can I get all the values ? angiras Hi, If I understand your requirement correctly, this should do it Dim Items() As String = {"A", "B", "C"} Dim Other(Items.Length - 1) As String Items.CopyTo(Other, 0) To more closely match you code above, but this will be less efficient Dim Items(), Other() As String ...

difference between String and string #2
difference between String and string String selectedMode = DropDownList1.SelectedValue; string selectedMode = DropDownList1.SelectedValue;Mark As Answer If my reply helped you. There are no differences. The name "string" is an intrinsic type that is mapped to the "String" class.Thanks, EdMicrosoft MVP - ASP/ASP.NET They are the same , Jeev~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~If you get the answer to your question, please mark it as the answer. Nothing - string is just the C# alias for System.String. C# defines a number of aliases for CLR types. They may be used...

a string in a string in a string in my code behind....
I know my title talk about code-behind, but this is really a client-side problem (and surely a newby one too, sorry about that).I have a javascript function that my make a little text appear when the onmouseover event of a link is activated.So, normally, if my link was inside my html code, it would be something like this:<a href = ""  onmouseover="poplink('I want to test something');">test</a>BUT, for some reason, I have to write this part in code behind with the LiteralControl function....and that will give something like that:this.Controls.Add(new LiteralCo...

m_AVP As IDictionary(Of String, String) = New Dictionary(Of String, String) ,not defined?
   I am creating a usercontrol (ascx,ascx.vb)   I have used Imports system.Collections Imports system.Collections.Generic     Private m_AttributeValuePair As IDictionary(Of String, String) = New Dictionary(Of String, String)     But I am gettting an error “Type Dictionary is not defined”   And also I am getting intelisense to type the line But what is the reason for my error ? How can I get escape from the error ?         this error is not showing today  ...

Get String #2
Hello,I am defining the following:Dim Names As String()Consider the following:A = {a, T}B = {b, T}C = {c}Every time I create Names string() I will define it as a value and T or just a value.Basically, I need to get the value a, b or c to a string Name.For example: for A: Name = a for C: Name = cHow can I do this?Thanks,Miguel     I think you need to re-word that in a practical real life scenario instead of using letters.  It doesn't make any sense.Josh Stodola ← Come check out my blog! :-)Ok, given a String Array with 1 or 2 elements how can I get the one which va...

Get 2 Strings
Hello,I have a string which has the following format (I give 2 examples):"FirstWord468x60SecondWord""FirstWord5x172SecondWord"I need to get the numbers 468 and 60, or 5 and 172 into strings FirstNumber and SecondNumber.How can I do this?Can I use a Regex?Thanks,Miguel You could use regex, by using the regex \d+x\d+.Brian"Trust in the Lord and do what is good; dwell in the land and live securely. Take delight in the Lord, and He will give you your heart's desires" (Psalm 37: 3-4). using regex to determine if the string match the format, yeah that's d...

String Manipulation
 Hello all, Using VB I'm trying to have a multiline textbox that a user will put in a quantity and a name as follows: 3xApple2xPear4xOrangeAnd when they click a button I want each part of this as a separate value, so far I have the following: Function GetSingleCards(ByVal AllFruits As String) As String Dim OurFruits As String() = Nothing Dim SingleFruit As String Dim ReturnThis As String OurFruit = AllFruits.Split(vbCrLf) For Each SingleFruit In OurFruits ReturnThis &= SingleFruit & ", " '...

How to copy strings in array of strings....I am getting some errors....
Hi, I want to display all the file names that are present in a specified directory....say "C:\data" in a GridView for that I am using the following: Imports System.IOPartial Class _Default Inherits System.Web.UI.PageProtected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim strFileSize As String = ""Dim di As New IO.DirectoryInfo("C:\data") Dim aryFi As IO.FileInfo() = di.GetFiles()Dim fi As IO.FileInfo For Each fi In aryFi strFileSize = (Math.Round(fi.Length / 1024)).ToString() Response.Write(fi.Name)...

How to replace string starting with "<!-- Start Here" and ending with "End Here-->" with another string?
I found a site yesterday that showed how to do this, but never saved it. For the life in me I can't seem to find it again. I'm sure its a function of some string class but I can't find it. In a much larger string I need to replace a string starting with "<!-- Start Here" and ending with "End Here-->" with another string? ThanksUsing Visual Studio 2005. Language: C# string s = "<!-- Start Here This is a test End Here-->"; s = s.Replace("<!-- Start Here ", ""); s = s.Replace(" End Here-->", "&qu...

How to read 2 column data to 1 String Builder or read 2 separate String Builders to 1 Reader?
Using StringBuilder object, I have been able to get data from a stored procedure.  The followingcodes show I can also create a link using the string data, which is the url address.  Then I added a link-description column to the stored-procedure.  However, the StringBuilder seemed tobe able to read one column only.  I created another Stored procedure to read the link-descriptionto another StringBuilder.  I got an error msg that the Reader object contained too much parameters.Apparently, the Reader can read one StringBuild...

Web resources about - string to string[] #2 -

Donald Trump sticks to claim he saw New Jersey Muslims celebrate 9/11 attacks
In a weekend of bad events for his campaign, GOP presidential front-runner Donald Trump continued his run of controversial rhetoric by claiming ...

Donald Trump Says He Would ‘Absolutely’ Bring Back Waterboarding Torture As An Accepted Form Of Interrogation ...
Business magnate and leading Republican candidate for the White House, Donald Trump, continues to resort to populism in his attempt to win votes. ...

The Best & Worst Sketches from Matthew McConaughey’s ‘Saturday Night Live’
Finishing out three weeks in a row of new episodes, Matthew McConaughey took the stage at Studio 8H to host Saturday Night Live for the first ...

'Spying' on Islamic State instead of hacking them
Meet the splinter group of online vigilantes targeting Islamic State

David Vitter’s loss in Louisiana isn’t an upset
Unsurprising. David Vitter’s loss in Louisiana isn’t as shocking as the media want to make it out. Reuters proclaimed last night’s win by Jack ...

Smite's Super Regionals Send Two North American And Three Euro Teams To World Championships
A week’s worth of competitive Smite play at Hi-Rez Studio’s in-house esports arena has come to an end, resulting in three European and two North ...

Flight Diverted Because of 'Unruly' Passengers
USA TODAY Flight Diverted Because of 'Unruly' Passengers ABC News Authorities say a Southwest Airlines flight headed from Indianapolis to ...

Jason Hatcher Accuses Officials of Making Bad Calls Against Washington Redskins Because of Their Nickname ...
MUST WATCH- #Redskins Jason Hatcher on his frustration with refs & how it feels personal because of the team’s name ...

American Music Awards 2015 Winners: Updating Live
The 2015 American Music Awards kick off Sunday night, honoring some of the biggest artists in the world. Taylor Swift, with her massive “1985” ...

'Hunger Games: Mockingjay Part 2' debuts to nearly $250 million globally
“The Hunger Games: Mockingjay Part 2” may have fallen short of expectations in the U.S. and Canada, but the series finale starring Jennifer Lawrence ...

Resources last updated: 11/23/2015 1:56:12 AM