|
Your code has improved already, however IMO OleDbCommand.Parameters.Add isn't strongly typed, all it does is add strings to some collection.
Not absolutely sure what exactly goes wrong, however my best guess is this:
"26-4-2011' is recognized as "dd-MM-yyyy" and works fine (it does not fit "MM-dd-yyyy"), however "1-5-2011" is recognized as "MM-dd-yyyy", which takes precedence over "dd-MM-yyyy". Regional settings are fooling you.
My suggestion was and is:
- first capture the user data, and turn it into variables of appropriate type; that implies validation;
- then use those variables when adding parameters.
Could look like:
bool allOK=true;
DateTime startDate=DateTime.MinValue;
if (!DateTime.TryParse(tbStartdate.Text, "dd-MM-yyyy', null, out startDate)) {
allOK=false;
log("startDate is not valid, should be dd-MM-yyyy format");
}
...
if (allOK) {
// construct and execute SQL query
}
Note: by explicitly specifying the format, you get independent of the system settings (if that is what you want, your users might want to be in charge).
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
modified on Wednesday, April 27, 2011 9:23 AM
|
|
|
|
|
Thank you,
I will check it and try to make it work.
Thanks again!
|
|
|
|
|
Hi;
I am trying to use MS Word as a reporting tool thru VB6. I have a problem
with getting the 'superscripts and subscripts'. What I have so far is not
good.
For example , 'y=3X^2+Xv+2X, with '^' being a 'superscript' and 'v' and
being a 'subscript'
send it to MS Word from vb6.
I would be grateful if anyone has a 'Micro to do this' and can post it or
send it to me -or can direct me to a website to download something that
will help me.
I would also be interested in third party tools at a reasonable price if it
can be used
from the vb6 not like MS Equation editor that I have to cut and paste the
image.
Regards,
M. Kol
mkol
|
|
|
|
|
|
thatraja
--------------------------------------------------------------------------------
Thank you for reading and answering my posting.
I hope you can come up with something.
Regards,
M.Kol
|
|
|
|
|
Hi,
I need help to draw a line graph in VB6 by using picture box. I have one senzor for light intesity and from this senzor i get Y value for my graph (in lux). X value for my diagram is a time. I need to draw 24-hour diagram of light intesity. Someting like on the link below.
http://img856.imageshack.us/i/dijagramosvjetljenja.jpg/
I dont konow how to draw x and y axes in pisture box, and how to my values (x-time, y-light intesity) plot in picture box.
Thanks
|
|
|
|
|
|
in my project, i need a lot of different formulas
so there is no standard formula and parameter
the parameter will write on textbox, the formula in richtextbox
example:
formula 1
Parameter = test1, test2 (so there are 2 parameters)
formula = test1 * test2
formula 2
Parameter = test1, test2, test3
formula = (test1 * test2) / test3
when i execute the formula
i write
strExec = "Dim formula" & vbCrLf
strExec = strExec & "Sub Main (" & parameter & ")" & vbCrLf
strExec = strExec & formula & vbCrLf
strExec = strExec & "End Sub" & vbCrLf
i use VBScript as the language
the problem is, when the run method
msScript.Run("Main", xxx)
the parameter doesn't have a standard value, i may 2 or 3 parameter
how to write in the xxx part?
i have try using array, but it return error
thanks
|
|
|
|
|
aphei wrote: how to write in the xxx part?
i have try using array, but it return error
Like this;
ref myArrayName
I are Troll
|
|
|
|
|
umm.. so, i just write msScript.Run("Main", ref strParam)?
it returns error
name ref is not declare
comma, ')', or a valid expression continuation expected.
do i need to imports anything?
thanks
|
|
|
|
|
Hi,
aphei wrote: msScript.Run("Main", ref strParam)
My apologies, accidentally posted c# syntax. Guess that would be "ByRef" in VB.NET, but I can't try it at the moment.
aphei wrote: do i need to imports anything?
Only the reference to the scriptcontrol, and I think you already have that
I are Troll
|
|
|
|
|
Our company is attempting to roll out Windows 7 (SP1) to new client boxes. There is one very large app that is causing the UAC box to pop up asking for administrative rights. Is there a utility or way to determine what section of code is triggering the UAC to popup? The application is very large and it would be nice to narrow down what area is requiring elevated rights.
Thanks for any pointers or guidance ahead of time.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
There's nothing that would cover all possiblities. Even Microsoft ACT[^] can't do it reliably. But, just in case, you'd best give it a try.
|
|
|
|
|
Hey Dave,
Saw your post Friday but forgot to reply. Yeah, I had tried ACT Friday, but didn't have much luck with it for this particular app. Thanks for the response though.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
No problem. We ran into this issue 2 year ago when we were considering moving from XP to Vista and had 1,000 apps to test. We quickly found out that there's nothing out there that can look at every app and tell you, definitively, which apps were going to work and which were going to fail, let alone how they were going to fail.
There's a few thing to look at. The first is if you're going to enable UAC and at which level.
The next is how your applications are going to react in a more restricted environment and how those problems are going to be mitigated. The results of some of this testing may affect the outcome of turning on UAC!
The third thing to look at is the installers for your apps. Depending on your deployment environment, your apps may not even install correctly.
We found a 40-50% failure rate in our installers alone. Most of those problems were easily resolved by either retiring the app if it was no longer needed, making only simple modifications to the installers, upgrading the app to a newer version, or using App-V to run the app.
|
|
|
|
|
I am creating an application were it will check installed applications(in win xp) compatibility for windows 7.
My application will run on machine running win xp and it will inform user that which installed application will have problems in windows 7 environment.
thank you.
|
|
|
|
|
Sounds useful, let us know when it's available for download.
The best things in life are not things.
|
|
|
|
|
Good luck with that! As someone heavily involved in testing 1,000 applications on Windows 7, let me tell you, no tool anyone writes is going to be able to tell you DEFINITIVELY if your applications will run on Windows 7. It's just impossible to tell until you double-click the icon and try everything out.
|
|
|
|
|
yeeh,in vb6 web activex we can call a js function like this
vb6 code
<pre>
UserControl.Parent.Script.Proc ("some msg !")
</pre>
the js function
<pre>
function Proc(msg)
{
alert(msg);
}
</pre>
it's work!
but when the js code like this
<pre>
function Proc(msg)
{
alert(document.getElementById("msg").innerHTML);
}
</pre>
it's not work! and there has an element "msg".why?
and it's error is:
run error "-2147352319(80020101) Automation error"
thnx
-- Modified Wednesday, April 20, 2011 3:31 AM
|
|
|
|
|
Here:
alert(document.getElementById("msg").innerHTML);
Remove the quotes of msg.
|
|
|
|
|
Hello,
I've written plenty of applications ran as scheduled tasks so I never had to worry about this before:
When an application is being ran as windows service: What is the best way to test when the system clock
hits a specific time (1:00am for example)? I know a timer is involved but is there a better way then
just checking at an interval because you couldn't be sure that it would hit 1:00:00 exactly, you'd have
to test a range of when it's greater then 1:00 and less then 1:01 kind of thing?
Please let me know how you do it....
Thanks,
Nathan
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
|
|
|
|
|
This maybe absolute overkill for your application, but I still thought I'd point you to this: Quartz.NET[^]. It can be embedded into an application and has "tons" of useful features.
Regards,
|
|
|
|
|
Thanks for the reply. Ya that's a whole lot of functionality for what I have in mind. Thanks though.
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
|
|
|
|
|
yep, you should treat timing values the same as floating-point values, i.e. avoid equality tests.
If your action has to happen at a specific time T, and must be executed for sure, then IMO you should test for
T <= DateTime.Now .
If the action doesn't make sense any more when a span S has elapsed, then test for
*T <= DateTime.Now) And (DateTime.Now < T.Add(S))
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Thanks for the reply. Ya I would of done it something like that. Would you choose a timer or a thread.sleep loop?
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
|
|
|
|