|
Hi,
why this repost? musefan[^] already told you SQL2000 uses question marks, not names, and hence needs the parameters in the right order.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Sunday, June 12, 2011 8:06 AM
|
|
|
|
|
Does anybody come across the requirement of compressing clickonce deployment files. My project is of size 80 MB which i want to compress and use clickonce to compress it copy it to client uncompress and install. (clickonce supports Http compress, which i don't want to use.)
any ideas?
Thanks.
|
|
|
|
|
Member 2324483 wrote: any ideas?
Yes, build a smaller app, or break the app into modules that can be downloaded when necessary.
only two letters away from being an asset
|
|
|
|
|
I have a C# application creating a pdf document. The pdf document might be open, or during creation caused an exception and other things can happen. I know I can catch FileNotFound, DirectoryNotFound and general IOException exceptions. However, if the file is open I want to be able to tell the user to close it or if my code caused exception halfway during the creation I want to be able to release the lock on it.
How can I find out what specifically happened? Is the file open? Did the creation failed halfway?
CodingYoshi
Visual Basic is for basic people, C# is for sharp people. Farid Tarin '07
|
|
|
|
|
following classes are derived from IOException:
DirectoryNotFoundException
EndOfStreamException
FileNotFoundException
FileLoadException
PathTooLongException
Calin
|
|
|
|
|
Suggestion, add appropriate checks and make your code full proof.
For instance, when you try to open the file (File.Open or File.OpenWrite)
- you can check for what all exception the API throws(MSDN should give you the list of exception it throws) and then you can return the appropriate Failure code(if your using a failure code mechanism) or rethrow the exception with a proper message based on the type of exception that occured.
- you should also add checks like File.Exists etc. The more checks you put the more confidence you will have.
- and if you are still not confident of things then additionally have a generic exception block for unhandled scenarios.
Well, in addition to the above you should have a finally block to release the lock no matter what happened in the processing.
|
|
|
|
|
This is a c#/sql reporting services problem.
Basically we have a c# application using the ReportViewer control to view sql reports. The problem is we have the c# culture set to display dates dd-mm-yyyy. When we go to view a report, it works fine, but the textboxes for the date parameters are refreshed incorrectly, they swap the month and day values. If we change the culture settings for the application to mm-dd-yyyy, it works fine, but this is unacceptable since it changes for the whole application.
Thanks in advance for any help
|
|
|
|
|
If anyone else is having this problem, I ended up solving it by just hiding the parameter controls and creating my own
|
|
|
|
|
Hello. In my project i have parsed my database into xml files. I done this by using typed dataset's writexml feature. After doing this and transfering these files to a remote machine that has the same database schema i need to merge that data from the xml to the machine's database.
In every row of every table there is a filed called last changed which i want to use to determin if the row is more current than the one on the machine's database.
How can the merging from the xml to the sql server be done? any ideas guys
|
|
|
|
|
Code. That's about it, really. Read the XML, write code to do the inserts.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
If this is a full-blown SQL Server box, you probably want to look at using SSIS to do this.
|
|
|
|
|
Any tutorials? please thank you
|
|
|
|
|
Hello,
I can't find what information I need, so I turn to you, the forum readers
This program I'd like to write--I'm trying to figure out how to print on paper a grid of squares with some custom info in each square. The problem I have is twofold: How do I print the squares, and how do I print the info in the squares all centered up and looking nice? Is there a way to tell where exactly text should be printed, or am I at the mercy of the printer?
Thanks for your time,
Michael Fritzius
|
|
|
|
|
Hello,
If you use PrintDocument control, you should be able to register for PrintPage event, which will give you Graphics object of page you are drawing. Using it (and additional info like resolution in X/Y, page marings) you should be able to draw whatever you want, just like in Paint event.
|
|
|
|
|
look into the Graphics class, when printing you basically pass a Graphics object with all your drawing on, so you will draw your grid and text on a Graphics object then pass that to the printer, with formatting options such as page orientation and margins if required.
The Graphics class has alot of build in methods for drawing rectangle etc by passing the location and size you want.
Also there is a DrawString method for drawing text, and a very useful MeasureString method you can use to determine the position to draw the text
Do a google for 'C# Graphics' and 'C# Printing' im sure you will get all the info you need
Hope this helps.
If only MySelf.Visible was more than just a getter...
A person can produce over 5 times there own body weight in excrement each year... please re-read your questions before posting
|
|
|
|
|
Hi,
printing is, or can be, very similar to painting to screen; you can reuse the exact same code however you will get different widths, heights, resolutions.
You might have a look at my Sokoban article, it has a Board class that supports printing.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Sunday, June 12, 2011 8:04 AM
|
|
|
|
|
I would use Word or HTML.
|
|
|
|
|
I have 20 years plus embedded experience but am new to C# and Windows CE so this will be a basic question...
I am developing a C# ap that requires some interface housekeeping to be done every 10ms. This ap is being tested on XP pro but will eventually go to an embedded device running Windows CE 6.
In normal embedded environments I would set up a hardware timer in the cpu and put the function in an interrupt routine.
We will have a small number of threads running that will be doing inbound message handling, MMI and some other functions. I think I need to have a "timer" thread called every 10ms to do this housekeeping so I have been looking at the various timer options. From Luc's excellent article on timers I see that the resolution of all timers except the multimedia timer will not be good enough.
So, am I barking up the right tree? Is there a better way? (Note that the housekeeping function varies in length)
Your input would be very much appreciated.
Many thanks Bruce
|
|
|
|
|
The majority of time I see requests requiring that sort of resolution it is because of a flawed approach. I don't want to suggest that your need is inherently flawed but maybe looking at the problem from another angle may device a solution that does not require 10ms housekeeping intervals, or even intervals at all. Events can work wonders if used correctly.
Need custom software developed? I do C# development and consulting all over the United States.
If you don't ask questions the answers won't stand in your way.
Doing a job is like selecting a mule, you can't choose just the front half xor the back half so when you ask me to do a job don't expect me to do it half-assed.
|
|
|
|
|
You'll need to add a reference at the top of your code for
using System.Threading;
Then in your code just add a sleep with:
Thread.Sleep(10); // Time in milliseconds
Hope this helps
Tom
|
|
|
|
|
Hello,
Remeber that when working on Windows, you have to face that your threads will be scheduled by OS, so sometimes getting exact timing is not possible. If you need about 10ms resolution, considering fact that threads gets about 10ms every time they are executed (that's simplified truth), I would try fe. such approach:
1. Check how much time has elapsed since last update.
2. If not enough, yield.
2. Set new "last update" to now.
3. Do some stuff.
4. Yield.
For timing you could use System.Diagnostics.Stopwatch timer. This one will use Query.. mechanism if possible to measure time, and that means even about 0.1ms resolution afair. This is the better timer you can get.
For yielding you could use fe. Sleep(0).
I don't know if this idea would work as expected, but maybe it's worth trying out.
|
|
|
|
|
Hi Bruce,
Bruce Coward wrote: From Luc's excellent article on timers ...
Thanks for that.
I don't know how timers behave on WinCE, however you can easily find out using my or similar test code.
If 16msec is good enough, then chances are any kind of timer would do. If not, multimedia timers are the only standard way I know to generate periodic events at a rather high frequency; I don't know whether they are available on WinCE, I hope they are.
If you are running .NET 2.0 or later, there is the StopWatch class which measures time with
1 msec accuracy (again, unsure about WinCE though); but it does not trigger events...
(if everything else fails you could have a very low priority thread looping and reading a StopWatch, then sending an event to another thread working at normal priority; I would not try and switch thread priorities all the time!)
The desktop versions of Windows are not real-time oriented at all, as you are probably aware of; I don't expect WinCE to be much better at consistently reacting with a reasonable latency. Therefore, when attaching lab equipment and the like, I used to leave the initiative to the central PC as much as possible; you may call that a polling architecture, I don't care, it often looks as the one way to get things working as reliable as can be achieved when Windows is part of the game.
Warning: .NET having garbage collection makes things worse as far as real-time goes: when
a process needs free memory due to some object being created, and there isn't sufficient free memory available, the gc kicks in, temporarily stops all threads, scans the data structures to find the live objects, then releases the threads and lets a gc thread collect the dead objects. In my experience it is worthwhile to help a little by:
- not creating any more objects than really necessary during the critical parts of the app;
part of that is reusing objects rather than replacing them (strings pose a problem here!)
- possibly, it depends, calling GC explicitly once a critical part is done.
A totally different approach may be to add lots of buffering to the peripherals, that is assuming you only need to protect the distributed system against data overruns at the PC side. It would not help when latency is critical.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Friday, February 13, 2009 1:35 PM
modified on Sunday, June 12, 2011 8:04 AM
|
|
|
|
|
Hi Guys,
Many thanks for all your inputs. Very valuable to a Windows newbie!
What I think I will do is run a thread with normal priority that tests the stopwatch elapsed ticks value and do my 10ms tasks when it trips over frequency / 100 to give me ticks per 10ms.
I have set the code to relinquish the cpu if the stopwatch tick count hasn't incremented sufficiently this cpu time slice. I am assuming the time slices are about every ms.
Here is the code. Any comments or anything I am doing wrong?
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Threading;
namespace WFSO
{
class Program
{
static void Main()
{
Thread t = new Thread(Tick);
t.Start();
Console.ReadLine();
t.Abort();
Console.ReadLine();
}
static void Tick()
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
long tickcount = Stopwatch.Frequency / 100;
while (true)
{
if (stopWatch.ElapsedTicks > tickcount)
{
stopWatch.Reset();
stopWatch.Start();
}
Thread.Sleep(0);
}
}
}
}
Thank you once again. Bruce
|
|
|
|
|
Hi Bruce,
Bruce Coward wrote: I am assuming the time slices are about every ms.
Where do you get that idea? The scheduler runs based on the system clock, that is around 16 msec on modern hardware (it used to be 55 msec on Pentium 3 running Win95), and it corresponds to the base frequency of regular timers, see my timers article.
It could be better on PDAs running WinCE, I don't know (and don't expect it to be).
Hence, your code will approximately run at 16 msec intervals, each Thread.Sleep(0) will make it wait for the next tick; the StopWatch is not going to do anything useful in that code.
BTW: why aren't you using a multimedia timer (assuming it exists on WinCE)?
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Sunday, June 12, 2011 8:04 AM
|
|
|
|
|
"Time slice every 1ms"
I think I read that in the embedded training but I am now checking again.
Many thanks, Bruce
|
|
|
|
|