.net

There is already an open DataReader associated with this Connection which must be closed first

▼魔方 西西 提交于 2021-02-04 19:50:13
问题 I am using Visual Studio 2010 (C#) with mysqlConnector and everything seems to be fine. However, when I try to request something from the server I get this error: "There is already an open DataReader associated with this Connection which must be closed first." This is my code: gc.connect(); List<Conseiller> conseillers = gc.getAllConseillers(); -- public void connect() { string connStr = "SERVER=localhost;UID=root;DATABASE=Projet;Password=root"; oConn = new MySqlConnection(connStr); try {

WPF Mediaelement.Position is not working

蹲街弑〆低调 提交于 2021-02-04 19:18:45
问题 What I need is to set the Position property on WPF's MediaElement control. But when I play the video, (either via Play() or through some kind of animation on Opacity ) it is is not working at all. It is showing 00:00:00 time, but I would expect it to be set to 00:00:05. I have hard-coded Position value and it is not working at all. Just In case I am going to put all my code I have so u can see the whole animation logic. Any clue? public partial class CrossFadeTransition : UserControl {

How can I intersect two different .NET lists by a single property?

徘徊边缘 提交于 2021-02-04 18:29:25
问题 I'm trying to filter my first list of Foo's based on some values in a second list of Baa's. For example. Here's an example I put up on .NET Fiddle ... var foos = new List<Foo> { new Foo { Name = "Leia" }, new Foo { Name = "Han Solo" }, new Foo { Name = "Chewbacca" }, new Foo { Name = "Luke" }, }; var baas = new List<Baa> { new Baa { Alias = "aaaaa" }, new Baa { Alias = "bbbb" }, new Baa { Alias = "Leia" }, new Baa { Alias = "Luke" } }; // Expected output: // List<Foo> results = Foo { "Leia" }

C# post increment and pre increment

二次信任 提交于 2021-02-04 18:29:07
问题 I get very confused at times with the shorthand increment operation. Since when i was little programming in BASIC, i got some how stuck with a = a+1 which is long painful way of saying 'Get a's current value, add 1 to it and then store the new value back to a'. 1] a = a +1 ; 2] a++ ; 3] ++a; 4] a +=1; [1] and [4] are similar in functionality different in notation, right? 2] and 3] work simply differently because of the fact that the increment signs ++ is before and after. Right? Am I safe to

TempData not carrying over during RedirectToAction

落爺英雄遲暮 提交于 2021-02-04 17:22:16
问题 I have an interesting problem with the TempData object not passing values to another controller. I set TempData["Enroll"] in the Enroll Controller 's HttpPost method to an Enroll Model. I then read the TempData["Enroll"] object in the Register Controller 's HttpGet method, but is empty / null . I need to persist all of this data across 3 controllers. Any thoughts? Here is a code Snippet //EnrollController.cs [HttpPost] public ActionResult Index(EnrollModel model) { // ... TempData[

TempData not carrying over during RedirectToAction

孤人 提交于 2021-02-04 17:21:37
问题 I have an interesting problem with the TempData object not passing values to another controller. I set TempData["Enroll"] in the Enroll Controller 's HttpPost method to an Enroll Model. I then read the TempData["Enroll"] object in the Register Controller 's HttpGet method, but is empty / null . I need to persist all of this data across 3 controllers. Any thoughts? Here is a code Snippet //EnrollController.cs [HttpPost] public ActionResult Index(EnrollModel model) { // ... TempData[

TempData not carrying over during RedirectToAction

烈酒焚心 提交于 2021-02-04 17:21:10
问题 I have an interesting problem with the TempData object not passing values to another controller. I set TempData["Enroll"] in the Enroll Controller 's HttpPost method to an Enroll Model. I then read the TempData["Enroll"] object in the Register Controller 's HttpGet method, but is empty / null . I need to persist all of this data across 3 controllers. Any thoughts? Here is a code Snippet //EnrollController.cs [HttpPost] public ActionResult Index(EnrollModel model) { // ... TempData[

Open generic interface types of open implementation don't equal interface type?

故事扮演 提交于 2021-02-04 17:17:49
问题 Here's a test that should, in my opinion be passing but is not. [TestMethod] public void can_get_open_generic_interface_off_of_implementor() { typeof(OpenGenericWithOpenService<>).GetInterfaces().First() .ShouldEqual(typeof(IGenericService<>)); } public interface IGenericService<T> { } public class OpenGenericWithOpenService<T> : IGenericService<T> { } Why does this not pass? Given Type t = typeof(OpenGenericWithOpenService<>) how do I get typeof(IGenericService<>)? I'm generally curious, but

Checkbox with RightToLeft flow direction in Windows 8.1

∥☆過路亽.° 提交于 2021-02-04 16:46:35
问题 Why checkbox checked mark appears with mirrored image in windows 8.1, when applying FlowDirection as RightToLeft. it is normally in other windows os. <CheckBox HorizontalAlignment="Center" VerticalAlignment="Center" IsChecked="True" FlowDirection="RightToLeft"> 回答1: if you want this as same in other OS, edit the template and hard code as left to right for the Tick. 回答2: I found this answer on another search.. You could set your own style to the checkbox: <Window x:Class="WpfApplication21

.Net Assemblies Security - Prevent Hacking / Reverse-Engineering [closed]

陌路散爱 提交于 2021-02-04 16:22:06
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 8 years ago . I have intellectual-property coded into .net 2.0 fully-trusted assemblies (.exe + DLLs) on an end-user machine, which I would like to protect from being hacked / reverse-engineered (WebService / Cloud-Computing