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

Top 5 Contributors of the Month
Imran Ghani
Sohaib Khalid
Post New Web Links

How do i detect the NewLine char in the string?

Posted By:      Posted Date: September 30, 2010    Points: 0   Category :Sql Server

hi friends,

i have the following list of csv string assigned to

@csv = '1,sdfssd,23.44,1

the string has two rows and each row is seperated by a new line char, assume im to read this string, is there a char symbol in SQL to identify the new line char or the enter key?



View Complete Post

More Related Resource Links

P/Invoke: char[] or string?

From a .NET Compact Framework (that's why coredll is used) code: [DllImport("coredll", EntryPoint = "RegCreateKeyExW", CharSet = CharSet.Unicode)]<br/> internal static extern int RegCreateKeyEx(<br/> uint key,<br/> char[] subKeyName, // or prefer string?<br/> int reserved,<br/> string className,<br/> int options,<br/> int samDesired,<br/> ref int securityAttributes,<br/> ref int result,<br/> ref int disposition); Both version seems to work (string and char[] ). Which advantages/disadvantages to they have? Which should I prefer? In the sample above string is used for className parameter but char[] for subKeyName which looks a bit strange for me.Programming is a kind of art but not all programmers are artists.

Marshal of C++ char[] to C# string

Hi guys, this is my problem. I have some C++ structure in unmanaged DLL. I need to use those structures in C#, in managed code.It seems all simple.... This is the C++ code of structures. Be careful to the structure "T__KRON_Struct_Error_Context" that is the structure that causes problems. ****************************  typedef char                    T__Char; typedef unsigned __int32        T__UInt32;  typedef enum {  KRON_ERR_SUCCESS       =1000,   KRON_ERR_RQC_DUPLICATED      =1601,  KRON_ERR_RQC_BAD_CONF_FILE     =1700, }T__KRON_Returned_Codes;  typedef struct {  T__KRON_Returned_Codes m__errorcode;  T__Char     m__errormessage[150];  T__Char     m__errorfile[256];  T__UInt32    m__errorline; }T__KRON_Struct_Error_Context; ***************************** My marshaling of structures in the C# Wrapper is the following:     [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential, CharSet = System.Runtime.InteropServices.CharSet.Ansi)]    public struct T__KRON_Struct_Error_Context    {        public T__KRON_Returned_Codes m__errorcode;        /// T__Char[150]        [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 150)]        public string m__errormessage;        /// T__Char[256]        [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.

Pass index number and find the char in a string?


How do i find the charactors in teh first index and the last index number of a string? 


Problem With SQL Char() to String


I am using a 3tier architecture for my project. I got some problem with data types from sql server. We do have some char type columns in database. first I got some conversion problme with it and finally I decide to use string varible to hold those char(10) values.

Now I got a new problem..If a table column value have Name char(10) in database.

class somename


string Name{get;set;}


When ever i read data from database its giving a string like this "AB        " if the table name field contains AB .

I have to check the name value with one default one like if(name="AB")

but due to this data type mismatch I doing like this.... if(name="AB        ").

Can Anyone please tell me how to over come this..I am using all strings for char sql datatype..is this a good practice...

Replace Escape char in string


Hello all,

I have a following string

"<Grid><IO/>\n<Body>\n<B>\n<I id=\"AR1\" Def=\"R\" Panel=\"\" Id=\"1\" Name=\"Activity 1\" Prent=\"\" ResourceName=\"Emp 1\" S=\"11/26/2010 12:00:00 AM\" E=\"12/16/2010 12:00:00 AM\" Predecessor=\"0\"/></B>\n</Body>\n</Grid>"

And i want it in following form



      <I id="AR1" Def="R" Panel="" Id="1" Name="Activity 1" Prent="" ResourceName="Emp 1" S="11/26/2010 12:00:00 AM" E="12/16/2010 12:00:00 AM" Predecessor="0"/>     





It means i want to replace \ char from upper string. How can i do this. please help.

I am struck very badly. Thanks in advance. please help.

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

How to detect and avoid memory and resources leaks in .NET application

Despite what a lot of people believe, it's easy to introduce memory and resources leaks in .NET applications. The Garbage Collector, or GC for close friends, is not a magician who would completely relieve you from taking care of your memory and resources consumption.

I'll explain in this article why memory leaks exist in .NET and how to avoid them. Don't worry, I won't focus here on the inner workings of the garbage collector and other advanced characteristics of memory and resources management in .NET.

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 ????

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.

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

Membership Provider Conn String


Hello. I've bee successfully using the Asp.Net Membership Provider in my VB.Net 3.5/SQL 2005 web app for a year now (Site A). However, I've added 2 new sites (B and C) (both with their own DB) and now I see a problem. It looks like users that get created for sites B and C also get created in site A. Roles that I create for B and C only get created in A. I think it is a conn string problem.

When I created A, I adde the conn string to my machine.config (not sure why I did this or if it is even needed)...


         <add name="LocalSqlServer" connectionString="Data Source=VS689\SQLEXPRESS;Initial Catalog=SiteA;USER ID=sa;PASSWORD=123456"/>


                <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=, Culture=neutral, PublicKeyToken=blahblah" connectionStringName="LocalSqlS

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