|
Elena2006 wrote: lakh
What does this mean ? It means 100,000 ? Try speaking English if you want to be clear.
The best way to insert a lot of records is to group them, so you don't call 100,000 stored procs. There's a lot written on this topic, all of it more indepth than you'll get from a forum reply. C# is kind of irrelevant, it's the DB that has to do to the heavy lifting.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Best option my experinece, Use the dataset and adapter.
if u do like, the query execution time is very short for insertion.
|
|
|
|
|
Forget using the DataAdpater. It inserts one record at a time.
Google for "C# SQL Server Bulk Load".
|
|
|
|
|
Hello folks,
I have a panel on a form with several other controls on it. The panel has to be a totally draggable over the form - and stop at that. Draggable only over the form! This is how I have implemented the drag and drop currently (see code block below). I need to ensure that the draggable panel doesn't tread beyond the form area irrespective of the form's size. I tried meddling with the height, location et all but then either it stops scrolling or doesn't come inside the form when i click.
can you please tell me how to ensure that the whole panel stays within the form(that is not even the corners go out of form)?
<br />
private void myDock_MouseUp(object sender, MouseEventArgs e)<br />
{<br />
isDragging = false;<br />
Invalidate();<br />
}<br />
<br />
private void myDock_MouseDown(object sender, MouseEventArgs e)<br />
{<br />
isDragging = true;<br />
clickOffsetX = e.X;<br />
clickOffsetY = e.Y;<br />
this.Invalidate();<br />
<br />
<br />
}<br />
<br />
private void myDock_MouseMove(object sender, MouseEventArgs e)<br />
{<br />
if (isDragging == true)<br />
{<br />
myDock.Left = e.X + myDock.Left - clickOffsetX;<br />
myDock.Top = e.Y + myDock.Top - clickOffsetY;<br />
this.Invalidate();<br />
<br />
<br />
}<br />
<br />
Invalidate();<br />
}<br />
<br />
Hoping for a solution,
-
Roger
|
|
|
|
|
I guess you can put check in the mouse move event whether panel's left, top, right, and bottom are less than that of your form's.
My idea of ideal life : Eat, Sleep, Repeat
|
|
|
|
|
you mean somethin like this??
if ((myDock.Left > this.Left) && (myDock.Top > this.Top) && (myDock.Bottom < this.Bottom) && (myDock.Right < this.Right))<br />
myDock is the panel and 'this' the form..
|
|
|
|
|
How can i display image of database in crystal report in visual studio 2005?
|
|
|
|
|
How can i display image of database in crystal report in visual studio 2005?
from that , what you are try to say man?
please present you question clear way for other help to you.
|
|
|
|
|
Hi!
I am using .Net 1.1. My application creates a thread to write to a file. At some conditions (e.g. User pressed Cancel button, it aborts the thread. The problem I am facing is if the code was at line
<br />
streamWriter = new StreamWriter(filename, false, Encoding.Unicode);<br />
and thread was aborted, the file cannot be written again.
Here is the log when the thread is aborted:
<br />
Thread was being aborted.<br />
at Microsoft.Win32.Win32Native.CreateFile(String lpFileName, Int32 dwDesiredAccess, FileShare dwShareMode, SECURITY_ATTRIBUTES securityAttrs, FileMode dwCreationDisposition, Int32 dwFlagsAndAttributes, IntPtr hTemplateFile)<br />
at Microsoft.Win32.Win32Native.UnsafeCreateFile(String lpFileName, Int32 dwDesiredAccess, FileShare dwShareMode, SECURITY_ATTRIBUTES securityAttrs, FileMode dwCreationDisposition, Int32 dwFlagsAndAttributes, IntPtr hTemplateFile)<br />
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean bFromProxy)<br />
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)<br />
at System.IO.StreamWriter.CreateFile(String path, Boolean append)<br />
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize)<br />
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding)<br />
<br />
Here is the log of exception I get when I try to overwrite the file:
<br />
at System.IO.__Error.WinIOError(Int32 errorCode, String str)<br />
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean bFromProxy)<br />
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)<br />
at System.IO.StreamWriter.CreateFile(String path, Boolean append)<br />
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize)<br />
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding)<br />
<br />
Is there any way I could assure that either the streanWriter initializes completely (because it is null due to Thread Aborted) or I could release the file?
Thanks for any help in advance
|
|
|
|
|
If you put it in a using block, that should help. How do you abort your thread ? Can't you just close the file when you check for an abort ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I have not tried using block. The reason is streamWriter is an instance field and the stream is closed after all the text written to the file (which is in different instance methods).
However, I have added a finally block which closes the streamWriter when not null. following is a code:
<br />
try<br />
{<br />
.<br />
.<br />
.<br />
this.generator.GenerateFile(outputFileName);<br />
.<br />
.<br />
.<br />
}<br />
catch(Exception exc)<br />
{<br />
LogError(exc);<br />
Log("File Generation failed.");<br />
}<br />
finally<br />
{ <br />
this.generator.CloseStream();<br />
}<br />
<br />
Following is the CloseStream(). Seems like streamWriter remains null.
<br />
<br />
internal void CloseStream()<br />
{<br />
if(streamWriter != null)<br />
{<br />
try<br />
{<br />
streamWriter.Flush();<br />
}<br />
catch<br />
{<br />
}<br />
try<br />
{<br />
streamWriter.Close();<br />
}<br />
catch<br />
{<br />
}<br />
streamWriter = null;<br />
}<br />
}<br />
<br />
|
|
|
|
|
Kashif Iqbal Khan wrote:
Is there any way I could assure that either the streanWriter initializes completely (because it is null due to Thread Aborted) or I could release the file?
In .NET 1.1: no, Thread.Abort is brutal there; I think it's impossible to guarantee correct resource cleanup
In .NET 2.0: Thread.Abort won't interrupt finally blocks, so you can do:
try {} finally { stream = new StreamWriter(...); }
to ensure the stream creation is not interrupted.
The best solution would be to not use Thread.Abort. Instead, make the abort button set a variable; the background thread should periodically check that variable and exit cleanly when it is set.
|
|
|
|
|
Hi,
I have a loop that loops through the data in my datagrid and checks for empty columns and reports them as errors. I need code to also check for ASCII values/data and report it.The code below is within the loop and checks for empty columns:
if (dgOutput.Rows[rowNum].Cells[colm].Value.ToString() == "")
error_per_row = error_per_row +"Error: Invalid characters on " + field_name;
Can anyone help to check for ASCII values.
Mvelo Walaza
Developer
Telkom SA
|
|
|
|
|
What do you mean by ASCII values ? All non blank strings are arguably ASCII values.
Why not parse your data source and any input instead of doing this all the time ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Christian Graus wrote: All non blank strings are arguably ASCII values.
Not quite - if the language in use is not written in the Roman script (Cyrillic, Indian scripts, CJK, etc) he may be right in considering ASCII values invalid.
Cheers,
Vikram.
The hands that help are holier than the lips that pray.
|
|
|
|
|
I'm trying to say that, if the datagrid rows contains any ASCII values/data it should display an error (add it to error_per_row). I would like code to check if any ASCII data exists in the row.
Mvelo Walaza
Developer
Telkom SA
|
|
|
|
|
OK - so you want to throw an error no matter what ? If the string is empty, or if it's not ? Or, can you tell me what you mean by ASCII ? Whatever you mean, and it's far from clear, you can do it with a regex.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I'm trying to say: if while looping through the data in the datagrid I come across data that is not normal alphabets (written in ASCII code), add "Invalid characters" to the 'error_per_row' vaiable.
Mvelo Walaza
Developer
Telkom SA
|
|
|
|
|
OK, well you failed utterly to say that. You can do that with a regex, easy enough. If you don't know how to use regular expressions, I'd recomend downloading the program 'expresso'
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hey
There is lot of way for that, get string and pass to char, then check ur ASCII is found in the grid cell value.
more info: please search in web.
|
|
|
|
|
Hi,
I already have a loop that loops through the datagrid and looks for invalid data. I would also like to check for any ASCII values that exist in the datagrid and report it as an error.The code below is within the loop and looks for empty columns. I would like to look for ASCII values/data:
if (dgOutput.Rows[rowNum].Cells[colm].Value.ToString() == "")
error_per_row = error_per_row +"Error: Invalid characters on " + field_name ;
Mvelo Walaza
Developer
Telkom SA
|
|
|
|
|
Hi guys
need help and info on how about creating an Application that will startup and run when our OS boot up and windows load up?
Any sample or online code to guide
Thanks A Million
KaKaShi HaTaKe
|
|
|
|
|
HatakeKaKaShi wrote: need help and info on how about creating an Application that will startup and run when our OS boot up and windows load up?
If you want your app to start when the user logs in, you can place a shortcut to your app in the Start menu's Startup folder. Typically, you would want your installation program to do this.
If you want your app to start when Windows starts, even before any user logs in, you should create a Windows service. There are plenty of examples on this on the web.
Cheers,
Vikram.
The hands that help are holier than the lips that pray.
|
|
|
|
|
Create a windows service application as shown in the link below:
http://www.c-sharpcorner.com/UploadFile/mahesh/window_service11262005045007AM/window_service.aspx
Regards,
Dave
Dave Traister
Software Engineer
ComponentOne LLC
www.ComponentOne.com
|
|
|
|
|
Hey
another way, put entry in registry for windows start up.
then application will start when ur os will boot.
|
|
|
|
|