Knvb1123's Q&A profile
Visual C++ Why do I get "The transaction has already been implicitly or explicitly committed or aborted"?
Without using TransactionScope the code runs fine. With ts, the exception is throwed when I call Update(). Below is my code in C++: try { Transactions::TransactionScope^ ts = gcnew Transactions::TransactionScope(); SavePatient(hPatient, hProgress); ts->Complete(); } catch (Exception^ e) { MessageBox::Show(e->Message, "Error!" ); } ////////////////////// void SavePatient(Patient^ hPatient, Progress^ hProgress) { row = m_rtpDataSet->Patient->NewPatientRow(); row->StudyDate = DateTime::Now; row->Name = hPatient->Name; //... save other stuffs &nb ...Show All
Software Development for Windows Vista GetWorkflowDefinition removed
In a previous beta there was a method WorkflowRuntime.GetWorkflowDefinition(). I am now using June CTP and that method has been removed from this object (this happened in beta 2.2 I think ). The method is available on the WorkflowInstance, but this is not what I need. Is there a workaround for obtaining the WorkflowDefinition of a workflow type without using an instance of that workflow type The scenario: I want to iterate through a compiled workflow type and get all activities of a specific custom type so I can add records corresponding to these activities in my workflow engine database. So, at this stage, there are no workflow instances for me to GetWorkflowDefinition ... I need to perform this step before instances can be created b ...Show All
SQL Server Internal SQL Statement
Need 1 SQL Statement to find out which databases have what tables with what Columns with what datatypes Hi, Sorry for coming back this late, but this should be a solution which might work in your case, oyu might encapture the foreachdatabase thing in your on logic to reuse it whereever you want to. There is an undocumented stored procedure of Microsoft sp_msforeachtable, which should not be used in your productional only for adhoc adminstrative queries as it is not guaranted to exist in future versions of SQL Server. DECLARE @DBCount INT SET @DBCount = 1 DECLARE @Counter INT SET @Counter = 1 DECLARE @SQLString NVARCHAR(MAX) SET @SQLString = '' IF OBJECT_ID('tempdb..#DatabaseTable') IS N ...Show All
Visual Studio <MSHelp:Attr> for Filter
I've generated my help files but get an error when I try to filter my integrated help files in VS. I placed an attribute directly below the locale example in utilities_metadata.xsl like this <MSHelp:Attr Name="FriendlyName" Value="MyAssemblyName.Help" /> where MyAssemblyName.Help is the namespace of the help collection I'm creating. then when I use the help integration wizard I create a filter to search for Name="FriendlyName" All I would like to do is select my help in the VS "Filtered By" drop down list so that only my help is visible in the tree view. I'm obviously doing somthing wrong but I can't seem to work out the correct combination of the Name, Value pair and how to filt ...Show All
Windows Forms Closing all forms but one
This can be a very simple question, but I can see the answer I have an Application (No Mdi) with one Main window that opens several non modal windows. When I hide the main windows I want to close every other window but Main. I already tried with foreach ( Form frm in Application.OpenForms ){ if (frm.Name != "frmMain"){ frm.Close(); } } But this loop can’t complete well because the form OpenCollection is modified. Any Sug thanks Don't use a foreach loop. I haven't tested this code but I'd do something like this: while ( Application .OpenForms.Count >1) { Application .OpenForms[0].Close(); } As long as Close wil ...Show All
Visual Basic SetPixel
Hi, I am trying to change a pixel color inside a gif file image, using the setpixel and this failed with the error - SetPixel is not supported for images with indexed pixel formats. What is the alternative to the setpixel function, for an indexed image N.b - I managed to use the getpixel to read from the image Thanks Jansen tamasu, You need to convert the indexed image to a non-indexed image. Here is a function to do that, along with a short demo that uses it: Imports System.Drawing Module Module1 Function CreateNonIndexedImage(ByVal src As Image) As Bitmap Dim newBmp As New Bitmap(src.Width, src.Height, Imag ...Show All
SQL Server Loop Through Flat Files Based On A Date Range
Hello, I currently have a For Each File container that loops through all files from a specific directory. The files have a naming convention that looks like this; CDNSC.CDNSC.SC00015.01012007 The last segment of the file name is the date of the data in the file (mmddyyyy). The create date for these files is always a day later than indicated in the file name. What I would like to do is to have more control over the 'range' of files that are looped through by using the date portion of the file name to define what group of files should be looped through. Ideally, I would like to have a 'StartDate' variable and an 'EndDate' variable that I could define at run time for the package, and the package would loop through all of the files ...Show All
Visual C# ContectSwitchDeadlock error
I tried running my app today and it came up with a strange error message : No symbols are loaded for any callstack frame. The source code cannot be displayed." When I click OK on the message box I get the following : ContectSwitchDeadlock was detected. The CLR has been unable to transition from COM context 0x1b1c78 to COM context 0x1b1de8 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid ...Show All
Visual Studio 2008 (Pre-release) VisualTreeHelper.HitTest returns null
Hi... I’m trying to use the VisualTreeHelper.HitTest method to check if a Canvas was hit or not after MouseLeftButton was hit.. protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) { Point p = e.GetPosition(this); HitTestResult hRresult = VisualTreeHelper.HitTest(myCanvas, p); if (hRresult ==null) { // Canvas was not hit,move window this.DragMove(); } else { //do something else.. } } Wheter if I click on the Canvas object (myCanvas) or not, hResult always is set to null.. What am I doing wrong Have a nice day /Erik What is it bad/wrong to hit-test the object itself I tried it and it worked ...Show All
SQL Server Web Service Task always failing
Executing the simplest of Web Service tasks consistently fail with the error: "Object reference not set to an instance of an object". This really isn't a very helpful message for this task, and there's nothing from the task editor that can be adjusted. I am using SP1, the HTTP connection to the service tests OK, the WSDL file downloads OK, and the methods and parameters appear OK. Suggestions Richard Hi, I have the same problem in the same webservice, but i must use a proxy, company will not allow me to bypass the proxy. Is there a fix to overcome this problem Is there a workaround I'm passing the parameters that the webservices provides i'm not using variables to fullfill ...Show All
Visual C# Printing a parameter value using Reflection?
Hi all, I need to print (actually log it using Log4Net) my parameter variables and its values. I got to get my parameter names using Reflection, but I am still stuck on how to get its current values. Any ideas on this Tanks Well, if its not possible to print parameters values and returns values, then why would I log a method I would rather count only on the stack trace to show me the method's entrance and exit... Right ...Show All
Visual Basic Extended Euclidean Algorithm
Read from message 4.. Ok.. I found a way (Theoretically..), and I need a little help to make it in a code.. For example, if we have: A = 416^217 Mod 375 217 is made of 1, 8, 16, 64, 128 (I don't know the name in English, but it's like 2^x), so we can write: A = 416^(1+8+16+64+128) Mod 375 Or: A = (416^1 * 416 ^8 * 416^16 * 416^64 * 416^128) Mod 375 Or: A = (416^1 Mod 375) * (416^8 Mod 375) * (416^16 Mod 375) * (416^64 Mod 375) * (416^128 Mod 375) I was told, that there is a mathematic law, that says that if: M = X^Y Mod D Then: X^(A*Y) Mod D = M^A Mod D So, in this case: 416^1 Mod 375 = 41 416^8 Mod 375 = 41^8 Mod 375 = 121 416^16 Mod 375 = 121^2 Mod 375 = ...Show All
Windows Live Developer Forums Find Location UK Postcode Error
Hi, I have been using the map.FindLocation function for quite a while now, just giving it a UK postcode everytime it always gave the correct results. Now it doesnt work at all and cannot find postcodes Is there any reason for this and will it be working again soon Thanks, James Hi Derek, It seemed to be a mixture of the service not working and a caching problem. It seems to be all operating okay now. Thanks, James. ...Show All
Visual Studio Using the MPF to Implement a Project Type (C#)
Hello, I am trying to create a simple new project type, following : http://msdn2.microsoft.com/en-us/library/bb166157(VS.80).aspx I have now run out of documentation on which interfaces etc I need to implement.. Should this bolier plate code actually do any thing Because I see no new project in the exp hive Thanks Tom Hi Tom, You need to ensure the package you're building is registering itself properly. There are a number of attributes on the package class that help set up the necessary registry keys. This can be done manually by running the RegPkg.exe utility. Or you can use the <RegisterOutputPackage> property in your .csproj file. I'm guessing this is why you aren't seeing the requisite re ...Show All
Visual Basic Watching a process.
I'm having trouble with this. Basically what I'm trying to accomplish is a server restarter. It needs to look for the server to close. I was thinking just look for the process to close. But I'm not sure how to do it. Could someone help please Thanks for this info. I'm still kind of confused as I am just learning VB, but your help is very much appreciated. If theres more specific info you could give I would be much obliged. If not thats quite alright you've helped quite a bit already. I will mark this post as answered but if you want I wouldn't mind more information if possible. ...Show All
