c# - How to remove special character while fetching data -


below query fetch data ,my problem ,i storing address field

address1%address2%address3

now while fetching want fetch adress1 (newline) adress2 (newline)adress3 how can ?

for e.g. dange%abc%pune

as dange

abc

pune

oledbdataadapter da = new oledbdataadapter(@"select firstname,lastname,address doctor_master type_of_dr='" + typeofdr + "'", con)) 

it's pity microsoft.jet.oledb.4.0 provider doesn't support replace() function microsoft.ace.oledb.12.0 provider does, otherwise easier you.

i think have fetch address field , use helper function convert string format want, this:

public string getbrokenlines(string address){    return address.replace("%","\r\n"); } //instead of using address directly, need pass getbrokenlines //method , expected result. 

for filling datatable using adapter, try this:

public static datatable getrefdrlist(string typeofdr, bool display){   datatable refdrlisttable = new datatable();   refdrlisttable.rowchanged += format;   //....   da.fill(refdrlisttable);   //.... } bool suppressformat; private void format(object sender, datarowchangedeventargs e){     if(suppressformat) return;        suppressformat = true;   e.row["address"] = e.row["address"].tostring().replace("%","\r\n");          suppressformat = false; } 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

php - Accessing static methods using newly created $obj or using class Name -