Im using asp.net using c#.net to retrieve a field from database. The field is xyz. It contains the data value say qwerty~rtyuup. I want to split the data right and left to ~ say(qwerty) and (rtyuup) using a string. For this i have used the code as follows:
String abc();
abc = con.dr["xyz"].Tostring().split["~"];
This is not working. Please help me thanx in advance.

Hi,

Split function returns "string array" not a string value.

Modify the code as follows;

string[] abc = con.dr["xyz"].Tostring().split('~');

Good luck.

Thanks for the reply but this is not working. I am getting an error saying Cannot apply indexing with [] to an expression of type 'method group'

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.