.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

I am trying to extract 2 figures of 1-4 digits out of a string.

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :WPF

hey all. i am just starting with C# and programming , dont have much experience and i run into a problem i cant seem to fix for the past 3 days.

I have the string

"{Width=444, Height=455}"

And i am trying to extract only the 444,455 everything i tried so far result  in giving me the whole string back {Width=444, Height=455}.

Any help would be highly appreciated.

View Complete Post

More Related Resource Links

extract picture data from a string


dears,advance thanks.can anybdy help to solve my problem which is describing below.

Example- %%D1,100,0,0004[data...][0d0a]

Head - %%D1
Amount of data package -100
The data package No. - 0
Data Length -1024 (0004 (low bit in front, high bit in back) 0004= 0x0400=1024;)

data- Original Picture data -1024(maximum)
Tail -0x0d0a
Data in hex

from the above example i want to extract picture data and need to store in to the sql table.sql table columname is image and datatype is also image.after that i wanted to display this image column to an aspx page.

expecting help asap.

RegEx Request - Extract an tag from string...

Hello, Can anyone give me a regular expression that will extract the <img> tag from a string.  I am receiving descriptions from an rss feed and the description contains an <img> tag in the text.  I want to extract the <img> so that I can display it in a different location on my page. I have fooled with some regular expressions, but my knowledge of them is not very good. Thanks in advance for any help!!

Extract String using RegEx

HelloI have below data in string format in a field in table and would like to parse the name from the quantity. The name should be anything before it hits a numeric numberin below example CHLORPHENIRAMINE is the name. i really appreciate if i can get a regex to extract the name from below string                                    "CHLORPHENIRAMINE 8MG CAP SA",                                    "CHLORPHENIRAMINE 12MG CP SA",                                     "CHLORPHENIRAMINE 4MG TABLET",                                     "CLEMASTINE FUM 2.68MG TAB",             &n

extract date from text string - Transact-SQL

Hello, I have a field in my database with an archived date... (Giampaoli  Live Oak, Almonds Archive 09/16/10) I need to be able to extract the date from this, then perform a datepart function on it... How do I extract the date into it's own value using just SQL? Thanks, Wes

Extract number from string


How i extract 0 from " flag=0" OR "flag = 0".

These are string value.

Extract String based on commas


Is there a simple way in a select query to obtain only part of a string counting from commas?

For example, I have a string with the following value:


The part I am interested is just OU=Lambert


The part of the string I want is always after the third comma from the right:

                                                  3                  2            1

And I don't actually need the OU= either if that helps.

Thank you in advance.

Allan Browning

Management Studio extract to flat file tool outputs dates with 9 digits after the point (unparseable



I hope this is the right forum for this. I tried exporting data from a table using this procedure:

  • SQL Server Management Studio -> Right-click on database -> Tasks -> Export Data...
  • Source: SQL Server, Destination: Flat File destination (delimited).

The data was correctly exported, but when I try to parse the file using FileHelpers, DateTime.ParseExact() fails for any date with non-integer seconds: I discovered the decimal part of the number of seconds has 9 digits, while DateTime.ParseExact() accepts only up to 7 digits, even with a custom format.

//The output date has the following format, and I can't:
// either find a format that accepts it,
// or prevent SQL server from outputting all those digits.
 "2010-10-12 16:21:10.960000000",
 "yyyy-MM-dd HH:mm:ss.FFFFFFFFF", //This doesn't work
//A FormatException is thrown.

Can I use OpenXML to extract xml string from the passed in XML?


Im using OpenXML in Stored procedure to read the input XML and populate SQL tables. I have a pretty large XML which has data to be inserted into 15 tables. I want create 15 stored procedures so that each of them handles inserts into one table.

I have one main Stored procedure that gets the complete XML and from there I want to split this xml into smaller trees and pass them to the corresponding stored procedures.

In the below example, Im looking at a way to extract the XML "


<data col1=val1 col2=val2 />

<data col1=val1 col2=val2 />

<data col1=val1 col2=val2 />

</table1>" to pass it to another stored proc.






<data col1=val1 col2=val2 />

<data col1=val1 col2=val2 />

<data col1=val1 col2=val2 />



<data col1=val1 col2=val2  col3=val3 col4=val4/>

<data col1=val1 col2=val2  col3=val3 col4=val4/>

<data col1=val1 col2=val2  col3=val3 col4=val4/>

<data col1=val1 col2=val2  col3=val3 col4=val4/>



Please note that I have just mad

How to Encrypt Query String Parameters in ASP.NET

Encrypt Query String Parameters in ASP.NET.u can send secure data one page another page u can also use query string to encrypt

Connestion string create any database server

This links important to how to create connection string to any data base sever.

SQL Connection String

We can learn or know how can we connect the database from our .net. This will help for freshers or .NET beginners!

Built-in Functions - String Functions

String functions let you extract various portions of character strings, change the case of strings, concatenate and reverse strings and perform many other types of manipulations. All built-in string functions are deterministic with the exception of CHARINDEX and PATINDEX

abstract away the source of the connection string using a class with a static property.

ASP.NET provides a configuration system we can use to keep our applications flexible at runtime. In this article we will examine some tips and best practices for using the configuration system for the best results.

The element of a web.config file is a place to store connection strings, server names, file paths, and other miscellaneous settings needed by an application to perform work. The items inside appSettings are items that need to be configurable depending upon the environment, for instance, any database connection strings will change as you move your application from a testing and staging server into production.

Let's abstract away the source of the connection string using a class with a static property.

highlight string


i am looking for a function that takes two string parameters 

str1 = "hello how are you today mr john"

str2 = "how today"

and in return it shoud highlight the words "how" and "today".

Any ides? I prefer if its possible using reg expression...Thanks

Could some one tell me whats the Problem with this String Manipulation ??? C#.net



I store some values from code behind to a label which is Hidden !

<asp:Label ID="lbl_Hidden" runat="server" Visible = "false"></asp:Label>

and at the page load event i retrieve the value of the label & assign it to a string !

stringvalue = lbl_Hidden.Text;

Now i dont know why this manipulation does'nt work !

I've a character 'A' in the string and i'm unable to replace it with a space !

stringvalue.Replace(A, " ");

Wot do u think abt it ????

connection string question from a newbie


when publishing  in the webmatrix dialogue it asks for "destination connection string" for my "database.mdf"

I was not sure what it was so I pasted this from my web.config file :

Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\database.mdf;Integrated Security=True;User Instance=True

it all published ok, but wont run, so I guess it has somthing to do with this connection string or some kind of configuration issue.

My question is this, What should go in the field for "Destination connection string"

WebMatrix conversion failed when converting from a character string to uniqueidentifier?


I am trying to retrieve xml from a small function in my .cshtml page. Its throwing me an error. This however, runs fine in a console/form environment.

It takes 3 parameters and 1 exception.

myDll.GetXML(year, username, uniqueidentifier, out ex);

When I run this page I get the error, "Conversion failed when converting from a character string to uniqueidentifier."

Or a stack of.

System.Data.SqlClient.SqlException (0x80131904): Conversion failed when converting from a character string to uniqueidentifier.

   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)

   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)

   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()

   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)

   at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()

   at System.Data.SqlClient.SqlDataReader.get_MetaData()

   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)

   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBeha
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend