New line character

I am writing code (VS2008/C#) that reads text file and passes the file data to SQL Server Procedure. I am reading data of file in StreamReader and passing as Input Parameter to procedure. I need to pass the New Line character also to the procedure.

1. The New Line character can be chr(13) & chr(10) or only chr(10). How to check this in C#?
2. How to pass New Line character to SQL Procedure?

Thanks

 

0
vijaygarg
1/15/2009 11:33:12 AM
📁 asp.net.object-datasource
📃 16182 articles.
⭐ 0 followers.

💬 3 Replies
👁️‍🗨️ 1105 Views

 Try using Environment.NewLine


Hanan Schwartzberg
--------------------
http://www.lionsden.co.il
0
lionscub
1/15/2009 11:42:21 AM

Environment.NewLine returns the new line defined in the environment. I need to check how the line is ending in text file?

Thanks

 

0
vijaygarg
1/15/2009 12:09:35 PM

 Sorry, I understand now. You can check like this:

if (strText.EndsWith(char.ConvertFromUtf32(13) + char.ConvertFromUtf32(10)))
{
    //do something
}
else if (char.ConvertFromUtf32(10))
{
    //do something
}


Hanan Schwartzberg
--------------------
http://www.lionsden.co.il
0
lionscub
1/15/2009 12:21:48 PM
Reply: