|
1 - you can do it in another thread
2 - you can show a progress bar, but it will mean making lots of smaller copies, which will slow down the process.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Wouldn't it have to be done row-by-row anyway?
When I copy data from one table to another I use a DataReader.
|
|
|
|
|
Does the table exist in the target database or do you need to create it too?
Are you doing this in a WinForms application? If so, why? I do such things in Windows Services.
0) Open a connection to the source database
1) Get a count of records to copy
2) Use ExecuteReader to get a DataReader for the records to copy
3) Open a connection to the target database
4) Set up a parameterized insert statement for the target connection
5) while ( reader.Read() )
5.1) Set the parameter values
5.2) ExecuteNonQuery
5.3) Update the ProgressBar
6) Close the reader, and both connections
|
|
|
|
|
thank u all especialy u pieballconsult for ur solution,the table exists in the destination table,and one more quenstion,when i executereader my select statement for reading from the source table,how can i access each column that is being returned to set it as an parameter for the insert statement?
|
|
|
|
|
dudes i found the ways to access those fields in datareader,so my last question is solved,but iv got a new problem,and that is i have a large amount of records in my database tables,so it would take a very long time for selecting and inserting into destination table row by row.how can i do that by copying the whole table at once,and insert it at once too.i might user dataset and its datatables,but it doesn't work,can anybody give me an example of filling a datatable of a dataset from connection 1,and insert that datatable into connection 2 database? thank u.
|
|
|
|
|
hello all
my question is there any method to determine if MonthCalender selected date is bolded or not?
|
|
|
|
|
Data bold means its a part of how you design. If you find it as SelectedDate means the date is already bold if bold is taken for your selection item.
|
|
|
|
|
Okay, I bet this question might have been asked dozens of times before, but at the end of the day, I am still confused.
I am working on a charting/plotting application. My application will also have WinForms controls. Please note that I dont want to use third party controls.
Edit: Actually it's little bit more than a simple charting application. I need to plot hundreds of symbols on the plot. Additionally, the plot will be interactive, e.g., selecting, moving or editing the symbols, adding/editing text on the chart itself. Any second opinions?
My current options are:
GdiPlus: Seems best, but does not supports hardware acceleration.
WPF: Practically, its still too slow.
SlimDX: Might be overkill
Tao: Don't know much yet
XNA: ditto
Since I plan to use Windows 7 features in my application, So this will be a blend of WinForms and custom graphics.
Any help or links comparing the above would be greatly appreciated.
"Do first things first, and second things not at all."
— Peter Drucker.
modified on Wednesday, November 11, 2009 2:09 AM
|
|
|
|
|
The NULL Developer wrote: GdiPlus: Seems best, but does not supports hardware acceleration.
Yes, that's just standard 2D C# code
The NULL Developer wrote: WPF: Practically, its still too slow.
It's done using DirectX, so if it's an option, why not use DirectX without WPF, if you want it to be faster ?
The NULL Developer wrote: XNA: ditto
Another technology based on DirectX.
your options are
1 - GDI ( or GDI+ )
2 - DirectX
3 - OpenGL
That's all that exists, everything else builds on one of those.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Microsoft Chart Controls for Microsoft .NET Framework 3.5 (Windows and ASP.NET)
Besides the libraries, get the VS add-on, documentation and massive 200 sample set.
They're great (IMO).
There should be a WPF version around too.
|
|
|
|
|
If you are supporting Vista SP2 / Windows 7 and up only, then you might consider using Direct2D[^], a new hardware-accelerated immediate-mode Windows graphics API. You will have to do a bunch of interop but if you badly need the performance it could be worth it.
Otherwise, you should be able to get decent performance out of GDI+ if you optimize well - buffering, batching, etc. If you use System.Drawing you'll have the advantage of being cross-platform as well.
If you don't mind using a non-free solution, there's VG.net[^], a vector graphics library that handles rendering for you, optimizes heavily, and is easy on memory.
|
|
|
|
|
hello, would anyone send me video watermarking source code... im in deadly need of it..
|
|
|
|
|
Harinsimhadri wrote: im in deadly need of it..
Then I suggest going to the jobs board and offering to pay someone to write it for you.
If you want to write it yourself, then my image processing articles might be a good place to start.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
thank u..
|
|
|
|
|
Hi...Can u please share the link...
As I am also deadly in the need for the video watermarking...
|
|
|
|
|
My image processing articles are on this site. They will not show you how to watermark a video.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I'm sorry if anyone posted this question before, but i was wondering how can i remove and XML tag, and i mean just the tag not the entire element example:
<font face="Arial">
<font style="FONT-SIZE: 12pt">Un tehnician în munca lui se foloseşte de diverse scule. Aproape orice trusă de scule conţine una sau mai multe şurubelniţe drepte (vezi figura1 </font>
<font size="3">si 7</font>
<font size="3">).</font>
</font>
to become :
<font face="Arial">
<font style="FONT-SIZE: 12pt">Un tehnician în munca lui se foloseşte de diverse scule. Aproape orice trusă de scule conţine una sau mai multe şurubelniţe drepte (vezi figura1 </font>si 7 ).
</font>
|
|
|
|
|
This is a tough question to answer without knowing the overall goal of the routine you are trying to write.
If you are just trying to eliminate unnecessary HTML, I recommend using a tool like HTML Tidy.
Writing your own solution to clean up HTML would require a great deal of effort.
If you simply want to remove all instances of <font size="3"> and the corresponding </font> surrounding text from your XML, there are a couple of options:
1 - Load XML into XmlDocument and use XSLT to transform output the way you like. You would have a XSLT template to match font[@size="3"] which would just output the inner content.
2 - Loop through the string, looking for instances of <font size="3"> and build a new string by adding the text between the <font size="3"> and the next </font> tag, eliminating the </font> tags.
My guess is that you are looking to cleanup unnecessary HTML, so I would go with a third party option for doing this.
|
|
|
|
|
Unfortunetly i never used XSLT and i don't really know how to used but that sounds like a good idea. I'll try to use it. And the sencond option doesn't really work for me because the input and output xml may vary very much.
Any help with XSLT world really be apreciated
|
|
|
|
|
I've not actually tested the code samples below, but they should get you started.
Create a file called mytransform.xslt with the following content:
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ><br />
<br />
<xsl:output method="xhtml" omit-xml-declaration="yes" indent="no" /><br />
<br />
<xsl:template match="/"><br />
<xsl:apply-templates select="font" /><br />
</xsl:template><br />
<br />
<xsl:template match="font[@size='3']"><br />
<xsl:value-of select="." disable-output-escaping="yes" /><br />
</xsl:template><br />
</xsl:stylesheet>
Use the following C# code in conjunction with the new XSLT to transform:
<br />
string contentToTransform = "<font>my text <font size=\"3\">some text</font> more text <font size=\"3\">end text</font></font>"; <br />
XmlDocument docToTransform = new XmlDocument(); <br />
docToTransform.LoadXml(contentToTransform); <br />
<br />
<br />
XmlDocument xDoc = new XmlDocument();<br />
xDoc.Load(HttpContext.Current.Server.MapPath("/mytransform.xslt")); <br />
XslTransform xsl = new XslTransform(); <br />
xsl.Load(xDoc);<br />
<br />
<br />
StringWriter sw = new StringWriter();<br />
HtmlTextWriter writer = new HtmlTextWriter(sw);<br />
xsl.Transform(docToTransform, null , writer)<br />
<br />
|
|
|
|
|
|
I need to get the LRC (longitudinal redundancy check) value of a string. This data is being sent to a credit card processing network over SSL. After I get the LRC I am coverting it to string, then to a byte, and adding it to the end of a byte[] to send through SSL. When I send the transaction I am getting a NAK response to my LRC. What am I doing wrong?
I have tried this
RequestMessage contains Message+ETX only
public static char ReturnLRC(string RequestMessage)
{
int lrcAnswer = 0;
for (int i = 0; i < RequestMessage.Length; i++)
{
lrcAnswer = lrcAnswer ^ (Byte)(Encoding.UTF7.GetBytes(RequestMessage.Substring(i, 1))[0]);
}
return (Char)lrcAnswer;
}
char charLrc = ReturnLRC(Trans);
string lrcString = charLrc.ToString();
byte[] LRC = unicode.GetBytes(lrcString );
fullMessage[addLRCHere] = LRC[0];
I have also tried this seperatly.
RequestMessage contains Message+ETX only
public static char theReturnLRC(string RequestMessage)
{
int lrcAnswer = 0;
byte[] byArray = Encoding.UTF7.GetBytes(RequestMessage);
foreach (byte curByte in byArray)
{
lrcAnswer ^= curByte;
}
return (char)lrcAnswer;
}
char charLrc = ReturnLRC(Trans);
string lrcString = charLrc.ToString();
byte[] LRC = unicode.GetBytes(lrcString );
fullMessage[addLRCHere] = LRC[0];
Neither process works, are the methods incorrect or is my conversions afterwards messing everything up? Thanks in advance for any help or advice.
Removing all the conversion confusion I found that I was generating the correct LRC. Thanks Everyone!!!
Kiotaya
modified on Monday, November 16, 2009 10:57 AM
|
|
|
|
|
I am amazed that a credit card company is using only LRC - I would have thought at least CRC-16.
However, assuming LRC is what they want, then I would be reasonably sure that it is the various conversions that are causing the problem. You are starting with a UTF16, convering it to a byte via UTF7, then back to a char (UTF16) and up to a string (still UTF16) and then back to a byte. I would start with a similar data set from them, and examine that. What do they send as the data, what do they send as the LRC? You should then be able to work it out from that.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
"Rumour has it that if you play Microsoft CDs backwards you will hear Satanic messages.Worse still, is that if you play them forwards they will install Windows"
|
|
|
|
|
Kiotaya wrote: (Byte)(Encoding.UTF7.GetBytes(RequestMessage.Substring(i, 1))[0]
This does not seem right: you choose UTF7 encoding, however for each string character you only use the first byte GetBytes returns.
You should have two distinct steps:
- represent your string as a byte array in the encoding of your choice;
- calculate LRC on that byte array.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Thank you for your response Luc. However it looks like what you are telling me is what I did in the second example I show. Please correct me if I am wrong in this assumtion. Here is the second example.
RequestMessage contains Message+ETX only
public static char theReturnLRC(string RequestMessage)
{
int lrcAnswer = 0;
byte[] byArray = Encoding.UTF7.GetBytes(RequestMessage);
foreach (byte curByte in byArray)
{
lrcAnswer ^= curByte;
}
return (char)lrcAnswer;
}
char charLrc = ReturnLRC(Trans);
string lrcString = charLrc.ToString();
byte[] LRC = unicode.GetBytes(lrcString );
fullMessage[addLRCHere] = LRC[0];
|
|
|
|