Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Apr 17, 2012 04:22 AM by vsdev
Member
64 Points
230 Posts
Apr 16, 2012 12:33 PM|LINK
Hi,
I have a Query
I have a field where in the field have data as F22:Stumpy, i just want F22 to store in database,hw can i do this?
Can any1 help on this? Thanks in advance.
Contributor
2965 Points
932 Posts
Apr 16, 2012 12:35 PM|LINK
hi try
string ss = "F22:Stumpy";
string[] s1 = ss.split(':');
ss = s1[0];
Participant
1837 Points
531 Posts
Apr 16, 2012 12:37 PM|LINK
string str = "F22:Stumpy"; Response.Write("<br />"+str.Substring(0, str.IndexOf(":")));
All-Star
95363 Points
14096 Posts
Apr 16, 2012 01:01 PM|LINK
you can also use SubString in SQL - http://msdn.microsoft.com/en-us/library/ms187748.aspx
Thanks,
5070 Points
1068 Posts
Apr 16, 2012 01:05 PM|LINK
hi..
In case if you want in sql query try the below code.....
declare @s varchar(50) set @s='F22:Stumpy'; select substring(@s,1,CHARINDEX(':',@s,1)-1)
4351 Points
1277 Posts
Apr 16, 2012 09:46 PM|LINK
hi
u can study and u can solve this issue.
pls ref this
http://www.dotnetperls.com/substring
thank u
2230 Points
453 Posts
Apr 17, 2012 04:22 AM|LINK
Use string.Split().
var data = "F22:Stumpy"; var result = data.Split(':'); var dataToInsert = result[0];
Pravind
Member
64 Points
230 Posts
split in string
Apr 16, 2012 12:33 PM|LINK
Hi,
I have a Query
I have a field where in the field have data as F22:Stumpy, i just want F22 to store in database,hw can i do this?
Can any1 help on this? Thanks in advance.
navneetmitaw...
Contributor
2965 Points
932 Posts
Re: split in string
Apr 16, 2012 12:35 PM|LINK
hi try
string ss = "F22:Stumpy";
string[] s1 = ss.split(':');
ss = s1[0];
Navneet Kumar Mitawa
shivalthakur
Participant
1837 Points
531 Posts
Re: split in string
Apr 16, 2012 12:37 PM|LINK
string str = "F22:Stumpy"; Response.Write("<br />"+str.Substring(0, str.IndexOf(":")));Response.Write("Success");
Best Of Luck
Shival Thakur
ramiramilu
All-Star
95363 Points
14096 Posts
Re: split in string
Apr 16, 2012 01:01 PM|LINK
you can also use SubString in SQL - http://msdn.microsoft.com/en-us/library/ms187748.aspx
Thanks,
JumpStart
vijay_myl
Contributor
5070 Points
1068 Posts
Re: split in string
Apr 16, 2012 01:05 PM|LINK
hi..
In case if you want in sql query try the below code.....
declare @s varchar(50) set @s='F22:Stumpy'; select substring(@s,1,CHARINDEX(':',@s,1)-1)My .NET blog
Submit Article
sriramabi
Contributor
4351 Points
1277 Posts
Re: split in string
Apr 16, 2012 09:46 PM|LINK
hi
u can study and u can solve this issue.
pls ref this
http://www.dotnetperls.com/substring
thank u
vsdev
Contributor
2230 Points
453 Posts
Re: split in string
Apr 17, 2012 04:22 AM|LINK
Use string.Split().
var data = "F22:Stumpy"; var result = data.Split(':'); var dataToInsert = result[0];Blog: dotnetthoughts
Download Capture It Plus