|
kselman wrote: myBackgroundWorker = new BackgroundWorker();
You must reconnect the events, this is a new instance of BackgroundWorker. You can't rest the original because the thread has already completed its work and has been returned to the pool.
only two letters away from being an asset
|
|
|
|
|
If you're re-starting the worker with RunWorkerAsync() the only exception would be InvalidOperationException, which means the worker is still running (IsBusy is true).
What exception are you getting?
--Bob
|
|
|
|
|
Welp.. Its working now.. not sure what was going on with it before. Unfortunately I changed too many things between testing and Im no longer receiving the Exception. It said something about "Background Worker has already completed"
I think was I calling ReportProgress during the Completed event.. but I tried to recreate the problem to report to you here.. but that didnt cause the exception. I also had a pointer to a helper class that was init'd outside of the DoWork function, but I put that back in and it still works.. *shrug* sorry.. i usually dont jump the gun and post a request for help.. but It sure seemed that I could not re-use the B.W. with out hooking its events back up. Which is not the case.. Just calling RunWorkerAsync() re-runs it as expected.
You reply did help, because you seemed confident to be able to re-use RunWorkerAsync and sure enough the problem was on my end..
Thanks for the quick replies..
-- Kevin
|
|
|
|
|
Good to hear it's working. I have an instance of a class which is a subclass of BackgroundWorker that reuses DoWork many many times. Never had a problem with it.
- Bob
|
|
|
|
|
How should i insert a word document into database.
I defined a Blob field in the database and i used this code
FileStream fls;
fls = new FileStream(path, FileMode.Open, FileAccess.Read);
byte[] blob = new byte[fls.Length];
fls.Read(blob, 0, System.Convert.ToInt32(fls.Length));
fls.Close();
query = "insert into Example(BLOBField)values(:BlobParameter)";
OracleParameter blobParameter = new OracleParameter();
blobParameter.OracleType = OracleType.Blob;
blobParameter.ParameterName = "BlobParameter";
blobParameter.Value = blob;
conn.Open();
cmnd = new OracleCommand(query, conn);
cmnd.Parameters.Add(blobParameter);
cmnd.ExecuteNonQuery();
cmnd.Dispose();
conn.Close();
What am i doing wrong. Its throwing up an error. Is there any other way to do this.
Thanks
Kal
|
|
|
|
|
kalyanPaladugu wrote: Its throwing up an error.
It might be helpful to say what the error is you are getting.
only two letters away from being an asset
|
|
|
|
|
ORA-00600:internal error code, arguments:
[koklgloblen:bnd][],[],[],[],[],[],[]
Thats the error its throwing. Iam able to
insert ordinary values like int and varchar
but not blobs
|
|
|
|
|
I figured out the error. I was able to insert into the database.
My second question is how should i retrieve it from the database.
If i execute the statement select * from table name its showing as orablob in those
columns i inserted. Is that the normal behaviour. Can some body provide the code to retrieve the word document from the database
Thanks
Kal
|
|
|
|
|
kalyanPaladugu wrote: Can some body provide the code to retrieve the word document from the database
Probably
kalyanPaladugu wrote: I figured out the error. I was able to insert into the database.
How about you share your solution. Its called give and take
Objects in mirror are closer than they appear
|
|
|
|
|
Its the same thing. The above code in the first link should work. Previously i was inserting into
two blob fields in the database from the same file stream object and so it failed. So i created
two file stream objects for two blob fields and it seem to work.
So if you run the code as it is i posted it should work as it is only one blob field in the database and one file stream object to load that
Thanks
Kal
|
|
|
|
|
How to retrieve the data from the blob field in the database
Thanks
Kal
|
|
|
|
|
i want to make splash screen to my Winapp
my splash screen first will be with transparent 0
will two 2 the transparent will be 100%
0 , 10 , 20 ,. .. ,100 transparent
how can make thing like this
Palestine
|
|
|
|
|
|
The default close/exit button on my form instantly closes the form when clicked.
However I would like the form to ask if I would like to save changes before closing when clicking this button.
I can't work out how to get access to the relevant function - assuming that is what i need to do. How should I go about solving this problem?
Thanks
Haz
|
|
|
|
|
Register to the Form.Closing event and use the passed CancelEventArgs object to cancel the closing process if needed.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hi, can anybody recommend to me a charting component that runs on .net compact framework?
/\ |_ E X E GG
|
|
|
|
|
I tried simple serialization as this:
<br />
<br />
<br />
ArrayList RouteData = new ArrayList();<br />
<br />
...<br />
<br />
publicvoid Serialize()<br />
<br />
{<br />
<br />
DataGridRow[] dgr = newDataGridRow[RouteData.Count];<br />
<br />
<br />
<br />
for (int i = 0; i < RouteData.Count; i++)<br />
<br />
{<br />
<br />
dgr[i] = (DataGridRow)RouteData[i];<br />
<br />
}<br />
<br />
XmlSerializer a = newXmlSerializer(dgr.GetType());<br />
<br />
StreamWriter sw = newStreamWriter(@"c:/aaa.txt");<br />
<br />
a.Serialize(sw, RouteData);<br />
<br />
}
I`m getting error... What do you think may be wrong?
thank you in advance for any help
|
|
|
|
|
-Yoyosh- wrote: I`m getting error...
What error do you get?
-Yoyosh- wrote: What do you think may be wrong?
Maybe they are just typos or somethings gone wrong while copying code but you should definitely put spaces behind every new keyword.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
1."There was an error generating the XML document."
InvalidOperationException
2.This is just copy/paste issue, all code is being compiled successfully, error occurs at run-time
|
|
|
|
|
Did u declare the class or the method as [Serializable]?
Everyone is a genius at least once a year - Pramod
|
|
|
|
|
You right, I forgot. I mark both classes with that attribute - the class, that elemets` are kept in this structure, and class that contains Serialize method.
I still get exactly the same error
Please note that I cannot mark a method with that attribute: "Error 2 Attribute 'Serializable' is not valid on this declaration type. It is valid on 'class, struct, enum, delegate' declarations only. "
Do you have any idea, or maybe i did something wrong?
|
|
|
|
|
You don't need to declare the method as Serializable,
Declare only the classes as Serializable.
If u still get error
please paste the code here so that we can see wht's going wrong.
Regards,
Everyone is a genius at least once a year - Pramod
|
|
|
|
|
Sure,
this is class, which object`s are kept in array/arraylist:
[Serializable]<br />
public class DataGridRow<br />
{<br />
public int Time;<br />
public float Speed;<br />
<br />
public DataGridRow(int t, float s)<br />
{<br />
Time = t;<br />
Speed = s;<br />
}<br />
<br />
public DataGridRow()<br />
{<br />
<br />
}<br />
}
And this is part of other class, that performs serialization:
ArrayList RouteData = new ArrayList();<br />
<br />
(...)<br />
<br />
public void Serialize()<br />
{<br />
DataGridRow[] dgr = new DataGridRow[RouteData.Count];<br />
<br />
for (int i = 0; i < RouteData.Count; i++)<br />
{<br />
dgr[i] = (DataGridRow)RouteData[i];<br />
}<br />
<br />
XmlSerializer a = new XmlSerializer(dgr.GetType());<br />
<br />
StreamWriter sw = new StreamWriter(@"c:/aaa.txt");<br />
a.Serialize(sw, RouteData);<br />
}
Please let me know if I missed something
(I may send it to you if you like)
|
|
|
|
|
OK,
After going through the above code what i think is that
when u are serializing u have to fetch each item from the Arraylist and serialize each object which is of the class DataGridRow, and also
mention the class name in the XML Serializer constructor.
Also change the file type i.e. c:\aaa.xml
Try the above changes, if it works well and good
if not just repost the error that u get and send the project so that we can
debug and check what's going wrong.
Thanks & Regards,
Pramod
"Everyone is a genius at least once a year"
|
|
|
|
|
At begin I wanted to serialize the ArrayList with all elements included. Then some guy told me, that ArrayList objects can`t be serialized, but I`m sure that 1D arrays are. So thats why I copied all elements from ArrayList to Array of type DataGridRow. So I don`t think there is a must to serialize each object separately...
I changed file name to aaa.xml, still I get the same error.
Here you can download this whole project (112kb)
thank you very much for help
|
|
|
|