string to string[]


I've got this code :

string[] Params;
SqlCommand myCommand = new SqlCommand(SQL, myConnection);
SqlDataReader myReader = myCommand.ExecuteReader();

while (myReader.Read())
Params_Type = myReader.GetValue(0).ToString();

My problem is to obtain Params_Type.
But each time, it says : "impossible to convert '[object]' in 'string[]' "
Thanks for all.
5/4/2004 11:28:26 AM 91979 articles. 4 followers. Follow

7 Replies

Similar Articles

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

Hello, try this instead:

int i = 0;
while (myReader.Read())
Params_Type[i] = myReader.GetValue(0).ToString();

Hope this works fine for u.
Bilal Hadiar, MCP, MCTS, MCPD, MCT
Microsoft MVP - Telerik MVP
5/4/2004 12:28:48 PM
Yes but, in my database I have in one column :

My sql return only one line.

and what I want is :

string[] Params = {"BURE_ETUD_ID","LANG_ID","LANG_NAME"};

5/4/2004 12:31:14 PM
You should, ideally, rework your database.  This is not a great layout.  You should have a table that links to this record and has one row per entry to allow you to better get at the data.

Given the string returned as it is, you could use String.Split() to create a string array.
Starting with ASP.NET 2.0? Look at:
Programming Microsoft Web Forms
My Blog
5/4/2004 12:42:12 PM
I Agree with you, but is there any possibility to convert one string in one string[] ?

5/4/2004 12:51:56 PM
Yes.  As I mentioned in my last post:  the String class has a Split() method.  Please look at the docs.
Starting with ASP.NET 2.0? Look at:
Programming Microsoft Web Forms
My Blog
5/4/2004 12:56:00 PM
I'm sorry, i haven't see the end of your message.

Thanks for your heulp
5/4/2004 1:00:42 PM

I believe yes, you should rework ur database, each value should be in one column. this is typical !!!
then, after u rework ur database, use the code i gave, it works just fine.
Good Luck.
Bilal Hadiar, MCP, MCTS, MCPD, MCT
Microsoft MVP - Telerik MVP
5/4/2004 1:21:23 PM

Similar Artilces:

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 ...

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 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...

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  ...

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)...

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 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...

RSA Encryption
Here is my goal:1. Take a string2. Encrypt it 3. Pass it as a parameter in the QueryString4. Decrypt it The value starts as a string, then is converted to a byte[] and then encrypted.  The resulting byte[] is converted to a string and send as a parameter.  The recieving page decrypts the string (creates a byte[], decrypts to a new byte[], and the value is finally parsed for its values) I am using with a small modification t...

Difference between String and string
When would you use String as apposed string, when writing functions certain functions work when defined as private string help ( string param){ } Others require the following private string help ( String param){ } Does anybody know why? In C#, string is an alias for the .NET Framework provided type String (and recall C# is case sensitive). I am not aware of any compelling reason to use one vs. the other.Starting with ASP.NET 2.0? Look at:Programming Microsoft Web Forms My Blog...

How to Encrypt a String to a String?
Hi Folks,I’m using Triple DES to encrypt a string… the output of the encryption is a byte array.However, I want to store the encrypted result as a string in a SQL Database and not as a byte array.(The reason I want to store it as a string, is to be able to copy & paste the result to a standalone windows form application  to decrypt it...) I’ve tried taking the byte array, converting it into a string…And then reconverting it into a byte array for the decryption. This causes an error upon decryption…How can I convert the encrypted byte array into a string and back into a byt...

Hello! I use SQLANY 5.5.05 and loking for one function which will do following: find string in string and replace it with another string. In version ASA 6 I found function STUFF which I think do something like this. Is there anything in 5.5.05? Regards Tomaz Try this: create function ReplaceString(in str long varchar,in old_substr char(255),in new_substr char(255)) returns long varchar begin // Change all occurrences of old_substr to new_substr in str. declare start_pos integer; declare found_pos integer; declare new_str long varchar; set new_str=&#...

Count no of strings in a string
dim ref as string ="<a href=""/iyp/yp/" hi i would like to know something how do i count the number of ref in a html document??you see i have another string call htmldoc(it contains a html document of a web page) and i want to extract all the ref in htmldoc how do i do that? 2) How do i include a closed inverted comma in a string?? dim a as string = "abcde"fghijk""" How do i use the mid method to seacrh from " ?? 1) You should learn about Regular Expressions 2) Double the quotes: "abcde"...

Web resources about - string to string[] -

Ted Cruz Tweets Ridiculous Fan-Made Star Wars Homage to His Candidacy
Republican presidential candidate Ted Cruz seems to think the force is on his side, because he tweeted out a fan edit featuring footage of his ...

Apple Pay Now Supports BJ's Wholesale Club Credit Cards and 66 New U.S. Issuers
Apple updated its Apple Pay participating issuers list today with support for BJ's Wholesale Club store cards, including the BJ’s Perks Plus ...

Sonos rolling out Apple Music support in beta from today
Sonos is beginning to roll out support for streaming Apple Music content to its wireless speakers starting today. The feature is available in ...

Saudi Arabia announces ‘Islamic military coalition’ with 34 nations to counter terrorism
State-run Saudi Press Agency released a statement that terrorism constitutes 'a serious violation of human dignity and rights, especially the ...

Own a drone? Get ready to register it with the FAA
Fortune Own a drone? Get ready to register it with the FAA (+video) Christian Science Monitor The Federal Aviation Administration announced ...

Seattle lets Uber drivers join union in US first
Seattle has passed a measure allowing drivers of smartphone-based taxi companies like Uber and Lyft to unionize over pay and other working conditions, ...

COP21: Shortest Climate Agreement Honeymoon Ever?
Guest essay by Eric Worrall The initial explosion of green Euphoria at the announcement of the COP21 climate agreement, is rapidly giving way ...

Cosby sues 7 accusers for defamation, seeks damages and retractions Cosby sues 7 accusers for defamation, seeks damages and retractions NEW YORK CITY: Bill Cosby has struck back against some ...

Kim Kardashian Having Another Baby Could Be Deadly
Kim Kardashian and Kanye West just had their second child and it sounds like it will be the last. Kim gave birth to her son Saint West recently ...

DHS will look at your Facebook activity before granting an entry visa
Revelations following the recent San Bernardino shooting prompted the U.S. Department of Homeland Security to focus on implementing additional ...

Resources last updated: 12/15/2015 3:26:08 PM