How to append DB values to a String
-
Hi , I just want a piece of code for appending a single column data base values of a table in a single string seperating by "," or "|".
-
Hi , I just want a piece of code for appending a single column data base values of a table in a single string seperating by "," or "|".
-
Hi , I just want a piece of code for appending a single column data base values of a table in a single string seperating by "," or "|".
fetch your code in datareader from the table than loop throw the datareader and add the values in the string. steps to do that SqlConnection con = new SqlConnection("YOur connection string"); SqlCommand cmd = new SqlCommand(con,"Your query here"); con.Open(); DataReader dr = cmd.ExecuteNonQuery(); //confirm if this is the write function to call string strValues = string.Empty; while(dr.Read()) { strValues += dr[0].ToString(); } Note: There may be a bit of problem in this code.. i hope u can fix that.
-
Hi , I just want a piece of code for appending a single column data base values of a table in a single string seperating by "," or "|".