Hello Guys
I retrieve value from database in the form of a,b,c,d,e
but i got ,a,b,c,d,e
So i don't want first , How to remove first comma Plz tell me Thank you
|
| Author: Shivshanker Cheral 05 May 2007 | Member Level: Diamond | Rating:  Points: 2 |
hi according to your questio what i suggest is you can use LEFT() function if this doesnot solve then explain your question
|
| Author: Smita 05 May 2007 | Member Level: Silver | Rating:  Points: 2 |
int count1 = ds.Tables[0].Rows.Count;
for (int i = 0; i < count1; i++) { string s="";
s = s + "," + ds.Tables[0].Rows[i][0].ToString(); } i got value ,a,b,c,d but i want a,b,c,d
|
| Author: Smita 05 May 2007 | Member Level: Silver | Rating:  Points: 2 |
i have written code this /***********
int count1 = ds.Tables[0].Rows.Count;
for (int i = 0; i < count1; i++) { string s="";
s = s + "," + ds.Tables[0].Rows[i][0].ToString(); } TextBox1.Text = TextBox1.Text+s.ToString();
i got value ,a,b,c,d but i want a,b,c,d
|
| Author: Shivshanker Cheral 05 May 2007 | Member Level: Diamond | Rating:  Points: 2 |
hi int count1 = ds.Tables[0].Rows.Count;
for (int i = 0; i < count1; i++) { string s="";
s = s + ds.Tables[0].Rows[i][0].ToString() + ","; } TextBox1.Text = TextBox1.Text+s.ToString();
s = left(s,length(s)-1);
|
| Author: Smita 05 May 2007 | Member Level: Silver | Rating:  Points: 2 |
s = left(s,length(s)-1);
left is not show in intellisence this is not working
|
| Author: Smita 05 May 2007 | Member Level: Silver | Rating:  Points: 2 |
i m using c# code
s = left(s,length(s)-1);
this is not working
|
| Author: Smita 05 May 2007 | Member Level: Silver | Rating:  Points: 2 |
s = left(s,length(s)-1);
sir this is not working in c#
|
| Author: Shivshanker Cheral 05 May 2007 | Member Level: Diamond | Rating:  Points: 2 |
steps to be done:
1. first u need to add a reference of "Microsoft.VisualBasic";
2. using Microsoft.VisualBasic;
3. TextBox1.Text = Strings.Right(s, s.Length - 1));
|
| Author: vishal 05 May 2007 | Member Level: Gold | Rating:  Points: 2 |
change a little bit in your code. use the following code: int count1 = ds.Tables[0].Rows.Count; string s=""; for (int i = 0; i < count1; i++) { if (i==0) s = ds.Tables[0].Rows[i][0].ToString(); else s = s + "," + ds.Tables[0].Rows[i][0].ToString(); } TextBox1.Text = TextBox1.Text+s.ToString();
you will get the proper value and use the statement --> string s=""; outside the for loop otherwise it will return only last row's value.
|
| Author: Smita 05 May 2007 | Member Level: Silver | Rating:  Points: 2 |
1. first u need to add a reference of "Microsoft.VisualBasic";
2. using Microsoft.VisualBasic;
3. TextBox1.Text = Strings.Right(s, s.Length - 1));
this code is running but output is abcd but i want a,b,c,d
|
| Author: Smita 05 May 2007 | Member Level: Silver | Rating:  Points: 2 |
Thank You Sir
|
| Author: Shivshanker Cheral 05 May 2007 | Member Level: Diamond | Rating:  Points: 2 |
hi vishal your code will runt but what hapens we need to check one more extra condition every time means if i have 1000 characater then i need to test the conditino 1000 times! so instead of testing 1000 times once removing the character is better choice!.......
|