|
logging to a file is already described in the article you link to. have a quick search for "FileAppender"..
|
|
|
|
|
ups sorry, yes you are right. looks like i didn't see it when quickly reading the article.
thanks for the hint!
|
|
|
|
|
Hi All,
I have a requirement to implement a common class for threading implementation for separate functionalities which support bulk data processing.Different pages(Main thread) need to call this class function, which need to create threads according to the number of data.Also after the threads executes it need to return some value to the calling page and bind it to the datagrid.
For eg:
Page A,B and C are may call the class ThreadImplementation.cs file. And in this class file i have function which will loop through the number of data that i got as input and split to sets of data and creates individual thread for each set. This thread will call the specific function in the same class for which Page A called the class. Say thread1 completes the execution, but how will show the same in the Datagrid in Page A, whose thread(Main) would have completed its execution by this time.
Specifically telling i can't make the Main thread to wait till the Worker threads are complete since the instantiation of the worker thread is done in the class file.
May i know i can implement this functionality some how.
Thanks and regards
KC
|
|
|
|
|
hi! I have this problem. I am trying to put a data from query in a XML document, the query sometime returns more then one row, and I want to display all of them in a XML document. With the current code, what I have I can return just one row,
Example I have two rows from the query:
PassengerID | Passenger Name | Passenger SSN |
1 John 2132
2 Jack 2323
With my current code, I am getting back the XML document just with the first row
<passengerid id="1">
<passengername>John
<passengerssn>2132
Any clue how I need to solve this?? I know that I need to use some for statement, but I don't know the proper way exactly. Thanks ahead
|
|
|
|
|
Without seeing your code we can't tell how it needs to be improved. If you are holding data in datatable then you can use WriteXml method to write its content to an xml file. If you don't know how to use for then I suggest you read basic book about c#
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
so this is the method what I am using for getting the data from DB and there I have a
private XmlDocument getTheData(string someString)
{
string query ="SELECT something FROM table WHERE something = '" + test + "'";
something=query;
string query3 = "SELECT something FROM table WHERE something= '" + test2 + "'";
something1=query3;
string query4 = "SELECT something FROM table WHERE something= '" + test2 + "'";
something2= query4
string query5 = "SELECT something FROM table WHERE something = '" + test2 + "'";
something3= query5;
return response.xmlDoc(something, something1, something2, something3);
}
Then I am returning the result from the queryes to the main method and I am getting the XML document, but just with one row of data, and when I am executing at SQL server studio
|
|
|
|
|
You can do a select that returns xml.
select .... from table1 for xml auto
There are various other options as well as auto, check them out in BOL, it could save yuo a heap of work.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
I am working at C# and I am building a web service, so when I will input the data, the XML document returns just one row of data, not more then one.
|
|
|
|
|
In which case I am missing something. Your original question
laziale wrote: hi! I have this problem. I am trying to put a data from query in a XML document, the query sometime returns more then one row, and I want to display all of them in a XML document. With the current code, what I have I can return just one row,
says you want to return all the rows in an xml document, now you say
laziale wrote: the XML document returns just one row of data, not more then one.
So what exactly is the problem? If you can clarify maybe we can help
Bob
Ashfield Consultants Ltd
|
|
|
|
|
well..let's say I have in the result from the query more then one row of data. So with my current code I am succeeding to get just the first row of data. I guess, I need to work with for and arrays, but I am not so efficient in that, that's why I am looking for your help. How can I get for example the second, the third row, etc. from the query what I will execute. Thanks
|
|
|
|
|
It all depends on how you are reading the data I guess. If you want to do row by row processing with a datareader you can, but I would either use the ....for xml method and return all the rows as a single piece of xml, or as was suggested, put the data in a datatable (using a dataadaptor) then you can use WriteXml method.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Friends can any 1 tell me how can I keep the task bar visible ( I mean active as it normally remains under each window form) in my form?
|
|
|
|
|
There are functions in the Win32 API that does this. I cant remember the names, but google should.
|
|
|
|
|
Hi,
Got this simple scenario where I've got a transactions_head table and a transactions_detail table. I've configured a master-detail relation with the Dataset Designer in Vstudio 2008. Now, when I create a new windows form using the designer I would have hoped this relation would be picked up. I've positioned fields from head-table above a datagridview with transaction_details(and then automatically get the bindingNavigator in the head). However, the datagridView designer generated code picks up all the rows in the db, disregarding my defined relation. Do I have to add the query manually? Just curios on how VStudio autogenerates code here, feel I am bit out of control there...
Best Regards
Anders
|
|
|
|
|
I have created a windows service, but there is a difference.. It has to interact with the user.. (I know this is not the usual way but the requirement was there so I had to make it..)
This was necessary because the user should have the option of exiting the process (I am building a tray icon for this, and for this I need desktop interaction.)
Now my problem is that I have made the user interaction possible programmatically (by writing code which checks the checks the checkbox - "Allow service to interact with desktop", its by editing registry.)
When I install this service, the checkbox is checked, but when I start the service, the user interaction dosent happen..!!
I have written lots of code and don't want to implement any other logic..
Please help me how can I make the service interact with the desktop..
Thank You..
|
|
|
|
|
|
Yes, MSDN says so but there is a workaround..
Read this[^].
|
|
|
|
|
Is there anything wrong with just running a normal Windows application?
But really, try to think about it. You start as a service, this happens before login, so where exactly is your UI suppose to go? See, it doesnt make sense. Rather start the app from start up.
All that said, here is probably the better idea:
1. Create a service.
2. Create a Windows Forms application, and add to start up folder or registry.
3. Use remoting to so the Winforms app can communicate with the service if necessary. BTW, you say you just wanna stop a service, so remoting will not even be needed (but somehow it seems you want to stop the service from within the service, not sure how that will work).
|
|
|
|
|
leppie wrote: But really, try to think about it. You start as a service, this happens before login, so where exactly is your UI suppose to go? See, it doesnt make sense. Rather start the app from start up.
All that said, here is probably the better idea:
1. Create a service.
2. Create a Windows Forms application, and add to start up folder or registry.
3. Use remoting to so the Winforms app can communicate with the service if necessary. BTW, you say you just wanna stop a service, so remoting will not even be needed (but somehow it seems you want to stop the service from within the service, not sure how that will work).
Thanks for the alternate choices.
But my service calls a console application and in this I perform background operations, like collecting system information.
I dont need that user must have UI at startup.
The service will start and call the console app. I have created a tray icon for the console app and whenever the user wants to shut down the console app, he right clicks the tray icon and stops it. The service dosent stop as such.
This is because the service launches the console app after some regular intervals of time to collect information data again.
Now you must have understood why I cant put it (the console app) in startup folder. That is because the app needs to collect information periodically which can only be scheduled by the service.
And if the service dosent interact with the desktop then the tray icon wont be visible.
Now have you got any suggestions?
Any help would be gratly appreciated.
Thanks !
modified on Tuesday, May 27, 2008 5:53 AM
|
|
|
|
|
Again, can a Windows Forms app not launch the console application? It can, and you can even run it (the console app) in the background without a shell window.
|
|
|
|
|
|
|
Hello Friends I have a main form in which there is a file menu strip. What I want to do is that when ever I click a menu strip of that menu a new for will be shown and all the menu strip will be disabled. And After I close the new form all the menu strips of the main form will be available again. What Can I write in form Closed method of the 2nd form? Can any one help me?
|
|
|
|
|
You can do like this..
ON MDI Form
public bool MenuItemControl
{
set
{
this.newToolStripMenuItem.Enabled = value;
}
}
ON FORM CLOSED EVENT
MDIParentForm MdiPF = (MDIParentForm)this.MdiParent;
|
|
|
|
|