|
If you want to insert current time and you're using SQL Server, you can use GETDATE()[^] function in the SQL statement.
|
|
|
|
|
|
Celie wrote: how do I invoke the INotifyPropertyChanged interface to transfer the setting of the visibility to the corresponding user-controls on ALL forms ?
You need to have implemented the INotifyPropertyChanged interface and provided an event for PropertyChange to which your forms can subscribe to. When form A changes the property of the object all other forms should get the notification if they are subscribed to the event.
only two letters away from being an asset
|
|
|
|
|
I am not sure If I got your question correctory.
I think what you could do is, all the Forms user control will provide (implement) a handler for the PropertyChanged event from the background form's user control and they will toggle their state accordingly.
But anyway, I am wondering why you designed like this??
Moim Hossain
R&D Project Manager
BlueCielo ECM Solutions BV
|
|
|
|
|
Hi,
This is my first message to this forum, so sorry for any mistakes.
I have created a worker thread which is filling a dataset. The thread action is as follows:
public void fillDataSet()
{
ds.Clear();
ds.Tables.Clear();
System.Data.OracleClient.OracleDataAdapter myAdapter = new System.Data.OracleClient.OracleDataAdapter(cmd);
try
{
myAdapter.Fill(ds);
return;
}
catch (ThreadAbortException)
{
return;
}
catch (System.Data.OracleClient.OracleException oe)
{
MessageBox.Show(oe.Message, "Oracle error");
return;
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "Application error");
return;
}
}
From the main thread, by clicking a button, i'm trying to abort the worker thread:
private void buttonAdv1_Click(object sender, EventArgs e)
{
t.Abort();
while (true)
{
if (!t.IsAlive)
{
MessageBox.Show("The script was cancelled by the user", "Script cancelled");
break;
}
}
this.Close();
}
The problem is that t.Abort() waits till the end of filling a dataset. The problem is when filling dataset takes an hour, then user have to wait this hour for any effects of cancelling.
Do you have any ideas how can you cancell filling a dataset immediately?
Thanks for any responses,
Kasatch
|
|
|
|
|
From a quick bit of googling, it seems the ThreadAbortException only applies when you're working with threads directly - it's obfuscated away when you're working with the BackgroundWorker. - See this article[^]
One fix would be to use a threadpool and create the thread manually - then this design *should* work fine.
You could also try the code in the above article, since it's trying to fix this particular issue.
|
|
|
|
|
Not sure about this, but I suspect that the reason for this behaviour is because Thread.Abort cannot abort the execution if it's done by unmanaged code. It must wait until the execution is returned to managed code. So if in OracleClient the fill mechanism is created using unmanaged code, that would explain the long period of waiting (until the Fill has finished).
The only thing that comes in mind is that you limit the execution somehow. For example, could you use DbDataAdapter.Fill Method (Int32, Int32, DataTable[])
[^] and set the maximum amount of rows for the fill.
The downside is of course, that you must set this before execution and even if the fill is fast, you won't get more rows than specified. However, perhaps you could first fetch, say 100 records and then have an option for the user to fetch the rest. This way you could split the operation to smaller parts.
|
|
|
|
|
i created a new thread and dynamically created a timer, in the thread a method is called and in it registered another method that update the db, what i want to do is to fire the tick event , i wrote the
private void dbtimer_Tick(object sender, EventArgs e)
{
dbtimer.Stop();
dbtimer.Interval = 1000;
dbtimer.Stop();
}
but it didn't fire
|
|
|
|
|
Of course it didn't fire, you stopped it just after starting it
only two letters away from being an asset
|
|
|
|
|
|
have you fixed your problem?
Cause the code you posted should fire atleast once, but you have put nothing in the event handler to actual do anything noticable
|
|
|
|
|
musefan wrote: Cause the code you posted should fire atleast once,
Really?? Not from what I'm seeing. That timer has to run for at least the interval specified before it's stopped in order to do that.
|
|
|
|
|
well the code he has posted only shows him setting the interval and stopping the timer inside the event handler. there is no code to show how the timer has been setup outside of that.
Maybe I am missing something here?
|
|
|
|
|
Yeah, you are. He called stop, set the interval, and called stop again.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
He did not call it, he placed that code in the event handler. which as we know now was never assigned to the timer tick event
|
|
|
|
|
Is this a trick question?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
sorry i was offline.
tanks for all who reply for my question, it's not a trick, actually stopping the timer twice in this code a mistake, but what i wanted was to fire the timer_tick event,to do so i have to register it with systemeventhandler isn't it when doing this dynamically.
i tried it in design and found that there is a code registering the timer_tick event with systemeventhandler .
|
|
|
|
|
No, its a 'tick' question
|
|
|
|
|
I have a dataset and when I write it to an XML file I am getting this:
<?xml version="1.0" encoding="utf-8" ?>
- <string xmlns="http://tempuri.org/">
- <DATASET>
<DATAROW ConfigItemName="xx" EnvironmentName="xx" AssetOnlyInd="x" AssetTagDesc="xx" SerialNum="xx" />
<DATAROW ConfigItemName="xx" EnvironmentName="xx" AssetOnlyInd="x" AssetTagDesc="xx" SerialNum="xx" />
<DATAROW ConfigItemName="xx" EnvironmentName="xx" AssetOnlyInd="x" AssetTagDesc="xx" SerialNum="xx" />
<DATAROW ConfigItemName="xx" EnvironmentName="xx" AssetOnlyInd="x" AssetTagDesc="xx" SerialNum="xx" />
<DATAROW ConfigItemName="xx" EnvironmentName="xx" AssetOnlyInd="x" AssetTagDesc="xx" SerialNum="xx" />
</DATASET>
</string>
When I try and access my dataset I am not managing..
Console.WriteLine(DatasetTest.Tables[0].Rows[0][0]); is giving me the result: 0.
Is my dataset not set up well? I've never worked with XML datasets so am not sure if I do in fact have the right rows and coloumns.. does that look right? How do I access the 1st coloumn of the 1st row?
|
|
|
|
|
ndroo882 wrote: does that look right?
Without knowing what the schema is how can tell if its right or not?
ndroo882 wrote: How do I access the 1st coloumn of the 1st row?
Am I getting this correct? You have a dataset which you are converting to XML so you can access it?
only two letters away from being an asset
|
|
|
|
|
Hi,
that is the XML file output I get when i do dataset.writexml to check what the contents are since I don't seem to be able to access through.
I want to be able to access the dataset (that I have built up from another xml string) and retrieve the 1st coloumn of the 1st row. That is the output of the dataset when I write it to XML. I guess the question is, wot is the code to access the dataset given it has that XML structure?
|
|
|
|
|
ndroo882 wrote: check what the contents are since I don't seem to be able to access through
Are you debugging your code? You can't look at with a data visualizer?
ndroo882 wrote: wot is the code to access the dataset given it has that XML structure?
The structure doesn't matter.
DataSet.Rows[0][0] or DataSet.Rows[0]["column_name"]
only two letters away from being an asset
|
|
|
|
|
|
|
Hi,
I have a ASP.NET web application which i am developing, and i have an other webapplication over which i have no control lets say for instance gmail.com. Now i wish to login to this other web application directly by passing UserName and Password.
The idea is to skip the login page and sparing the user, the hardship of manually entering UserName and Password.
Thanks in Advance
|
|
|
|