C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




C#


Posted Date: 04 May 2007      Total Responses: 12

Posted By: Smita       Member Level: Silver     Points: 2


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




Responses

Author: Shivshanker Cheral    05 May 2007Member Level: DiamondRating:     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 2007Member Level: SilverRating:     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 2007Member Level: SilverRating:     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 2007Member Level: DiamondRating:     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 2007Member Level: SilverRating:     Points: 2
s = left(s,length(s)-1);

left is not show in intellisence
this is not working



Author: Smita    05 May 2007Member Level: SilverRating:     Points: 2
i m using c# code

s = left(s,length(s)-1);

this is not working


Author: Smita    05 May 2007Member Level: SilverRating:     Points: 2
s = left(s,length(s)-1);

sir this is not working in c#


Author: Shivshanker Cheral    05 May 2007Member Level: DiamondRating:     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 2007Member Level: GoldRating:     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 2007Member Level: SilverRating:     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 2007Member Level: SilverRating:     Points: 2
Thank You Sir


Author: Shivshanker Cheral    05 May 2007Member Level: DiamondRating:     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!.......


Post Reply
You must Sign In to post a response.
Next : Roles
Previous : How to select treenode by javascript?
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design

doors in nj

Contact Us    Privacy Policy    Terms Of Use