.net-3.5

C# consume rss feed containing xml-stylesheet ?

Hi, I have a problem for parsing a rss feed using c#. I used to use this method to load the feed. XDocument rssFeed = XDocument.Load(@url); But, when I notice when the feed has a xml-stylesheet this method crashes saying the xml is not well formated... Here's a rss feed that contains this tag http://www.channelnews.fr/accueil.feed?type=...

Looking for a better way to sort my List<T>

I'm reviewing a piece of code I wrote not too long ago, and I just hate the way I handled the sorting - I'm wondering if anyone might be able to show me a better way. I have a class, Holding, which contains some information. I have another class, HoldingsList, which contains a List<Holding> member. I also have an enum, PortfolioSheetM...

How to change position of DataPoint labels in MSChart control

I'm having an issue with the MS Charting control and displaying data point labels. When I switch the graphs to a logarithmic view the point labels (which only appear directly above the bars) end up being written over the border as such: Chart Image (I'm sorry I can't post the image directly in the question ~ it's because of my low rep...

C# - Confirming all Keys in a dictionary have populated Values

I have a Dictionary<string, List<string>> I want to do a check that all Keys in the dictionary have at least 1 item in its corresponding list ...

C# - Removing Items from Dictionary in while loop

I have this and all seems to work fine but not sure why and if its valid. Dictionary<string, List<string>> test = new Dictionary<string, List<string>>(); while (test.Count > 0) { var obj = test.Last(); MyMethod(obj); test.Remove(obj.Key); } Update: Thanks for the ans...

VB "Financial.Pmt" equivalent in C#?

There is a built in function from the Microsoft.VisualBasic assembly. I can use it in VB like this: Financial.Pmt((dAPR / 100) / 12, iNumberOfPayments, dLoanAmount) * -1 My current project is in C# and I need to use this function. Answers on the web say just add the namespace and assembly and use the same in C#- but this is not true! ...

asp.net error: "Conversion failed when converting character string to smalldatetime data type"

I am getting an error when attempting to call a stored proc from my asp.net page. e.Message = "Conversion failed when converting character string to smalldatetime data type." The stored proc is being called by: The asp.net code that is calling the stored proc is: //Display search results in GridView; SqlConnection con = new ...

.net 3.5: (ip2hostname) find if a certain ip is used by another computer in domain

I'm working under a domain, and im making an app that changes ip from 1 to 253 until it finds an available, unconfliced ip (where it get's ping response from the domain, it tries to ping it each time it changes ip), this part works. the problem is, that i dont want the program to override an ip address that is used by other computers tha...

how to draw curve graph in c#

i have some count with names like Tennis 10 Cricket 12 Boxing 15 FootBall 20 Golf 14 i have drawn graph statically but i want to draw it has dynamic when ever values change graph should change please help very urgent. ...

What are the advantages and disadvantages of using caching in an asp.net application?

What are the advantages and disadvantages of using caching in an asp.net application? ...

Getting the date only in Convert.ToDateTime() in asp.net

Hi, I have a parameter string that passes date value to a stored proc cmdItemSearch.Parameters.Add(new SqlParameter("@EndDate", SqlDbType.DateTime)); cmdItemSearch.Parameters["@EndDate"].Value = Convert.ToDateTime(DateTime.Now); The value being passed is "6/30/2010 7:45:00 AM" I want to pass only "6/30/2010" How would I do that? ...

DateTime error message: Conversion failed when converting datetime from character string.

I am passing parameters to a stored proc. The parameters code block on the asp.net side is: SqlConnection con = new SqlConnection(strConn); string sqlItemSearch = "usp_Item_Search"; SqlCommand cmdItemSearch = new SqlCommand(sqlItemSearch, con); cmdItemSearch.CommandType = CommandType.StoredProcedure; cmdItemSearch.Parameters.Ad...

How to store class instance (helper class) in ASP.NET Cache?

I have a class instance which is created by using Activator.CreateInstance() method. That class instance contains helper methods which are frequently used throughout the application. In order to avoid creating the instance multiple times, I'm just thinking about implementing an appropriate caching mechanism. The following consideration ...

EXECUTE Permissions Denied - .NET and SQL2008 Compatibility Mode 100

We recently began testing our new SQL2008 servers running in Compat mode 100 and one of our .NET applications has stopped running and returning the error: The EXECUTE permission was denied on the object 'My Stored proc', database 'My Database', schema 'dbo'. Now I have already made sure that the login this application is making the c...

Access MySettings from other Project in Solution

Is it possible to access the My.Settings of an other DLL referenced in the current Project? I have a Database project in which Settings the ConnectionString is stored. I need access to this Setting in an other Project(for Log-File). ...

Converting a string to a float data type

I need to convert the contents of a Textbox (which is currency) to a datatype float. Would I convert to single? txtPurchItemCorrectPrice.Text.Trim(); ...

question about entity

i have such code var menu = _dataManager.Menu.Details(id); var menu2 = _dataManager.Menu.Details(id); menu.Name = "AAA"; in this case menu2.Name will be "AAA", i guess it because of reference, but how can i solve it? ...

windows authentication with a custom login page

So i only need to do windows authentication and not forms authentication. Instead of giving the user a popup box for login.. i want to have a login page with Username, domain and password..also an option of remember password. If the user does not exist it should just show that wrong username and password. I have 2 types of users: admin...

Logging Database Row alteration

I am using a strongly typed dataset in my C# application and I would like to be able to log any changes a user makes to a row. What is the best way to do this? ...

Flatten collection of individual dates into date ranges

Given a datatable of single day dates (dd-mm-yyyy), (shown below on the left). What's most elegant way to transform this into a collection of ranges, grouping consecutive days for each type (show on the right) ? We can assume initial data is sorted by TypeID, then Date. TypeID | Date -> TypeID | Start | End 1 ...