|
I've already tried SerialPort and faced a similar issue. I guess this has something to do with the flow control. I donot have control on the hardware part, but software - MSCommLib and SerialPort are the options I've tried. I've tried all the possible baudrates which the device supports, but in vain.
I've observed this: The combination of VB-MSCOmmLib.dll works on any system
C# - MSCommLib works fine only where the MS VS 6.0 is installed.
I also tried registering the MSCommLib.dll on non-VS 6.0 system, but its the same problem.
|
|
|
|
|
int mm =int.Parse(dateTimePicker1.Value.ToString("dd"));
int nn =int.Parse(dateTimePicker1.Value.ToString("dd"));
SqlCommand SCD = new SqlCommand("select * from table_inf where time>=mm and time<=nn", Conn);
i use data Sql2000,Field time's Property is datetime
what's wrong with it?
how can i change it
thank you everyone!!
|
|
|
|
|
you only get questions now,l for you to answer and deduce reasonable conclusions yourself:
what is the difference between mm and nn???
what type is dateTimePicker1.Value?
why would you turn it into a string and then parse that string? that type has a lot of interesting Properties. Start reading the documentation on that type!
and what is the type of your database table's "time" field? are mm and nn in your SQL of the same type as time?
|
|
|
|
|
1. You are comparing a date and integer. Compare dates with dates. You should use your date time picker's value right away.
2. See you select command:
miss YY wrote: select * from table_inf where time>=mm and time<=nn
Entire thing is a string. How is it supposed to get the values in mm and nn? You should read about SQLParameters class and use it.
Also, from the ToString overload you are using, it shows that you are just checking the day part of the date. Do you really want to do that way? If you want to check that way, you should use day(time) instead on time in your SQL and then compare. But be sure that this will ONLY compare the day part and not the month and year.
Edit: Missed what Luc spotted. Both mm and nn will have same values. So, why not just check equality with one value instead of two?
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
modified on Sunday, November 29, 2009 10:29 PM
|
|
|
|
|
miss YY wrote: how can i change it
What are you trying to do here? Both mm and nn variables will have same value and your query may not return any values.
miss YY wrote: i use data Sql2000,Field time's Property is datetime
Then you need to compare against a DateTime not just an integer variable that has date.
DateTime mm = dateTimePicker1.Value;
DateTime nn = dateTimePicker2.Value;
SqlCommand SCD = new SqlCommand("select * from table_inf where time >= @mm and time <= @nn", Conn);
SCD.Parameters.AddWithValue("@mm", mm);
SCD.Parameters.AddWithValue("@nn", nn);
Best wishes,
Navaneeth
|
|
|
|
|
Yes, but why use local variables at all?
|
|
|
|
|
Hi
To use transaction construct(as follows) in C#, MSDTC needs to be running on Windows machine. Right?
using (TransactionScope ts = new TransactionScope())
{
using (SharedDbConnectionScope sharedConnectionScope = new SharedDbConnectionScope())
{
// update table 1
// update table 2
// ts.commit here
}
}
1. Is MS-DTC a default service on Windows systems(XP, Vista, Windows 7, Servers etc)?
2. If it is not enabled, how can I make sure it gets enabled during the installation process of my application?
Please advise.
Thanks
AJ
Follow your goals, Means will follow you ---Gandhi---
|
|
|
|
|
You don't need it with the newer versions of SQL server like 2005 or 2008. It is only required if you are using SQL 2000. If you are using Oracle, then you need this service.
Best wishes,
Navaneeth
|
|
|
|
|
Not new to programming, but fairly new to .Net.
I have learned enough about C# to actually start doing something productive, but I am having trouble putting it all together. Most Windows Forms apps start by setting up the environment, opening databases, displaying the desktop, menu, etc. I'm so used to working with code snippets and other pieces of an application, that I don't know how, nor am finding in any resource I have studied, to correctly set up an application.
A picture is worth a thousand words, and would like to ask any members if there are any good, complete, example applications on this site (or anywhere else) that I can use as a springboard? Any help would be appreciated!
|
|
|
|
|
There are plenty of articles that let you download source code
|
|
|
|
|
Try Googling the following string @"open source .net C# Applications"
|
|
|
|
|
I need magic wand c# source code. can any body hep me?
Thanks
|
|
|
|
|
Hi,
I'm not sure anyone should be divulging this information.
See the referenced code of ethics from the IBM Board of Directors [^]
Alan.
|
|
|
|
|
i did not mean copy of magic wand of photshop. I mean, did any body have open source code of similar sctript.
thanks
|
|
|
|
|
I believe Harold Potter wrote an article about this?
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
Hi
I have a question concerning custom ConfigurationValidator, which verifies the entries in the app.config file. Below is the class which represents the section in the config file.
public class SettingSection : ConfigurationSection
{
[ConfigurationProperty("appId", IsKey=true, IsRequired=true), ConfigurationValidator(typeof(AppIdValidator))]
public string AppId
{
get { return (string)base["appId"]; }
}
}
public class AppIdValidator : ConfigurationValidatorBase
{
public override bool CanValidate(Type type)
{
return true;
}
public override void Validate(object value)
{
string val = (string)value;
Regex regex = new Regex(@"\A\d{4}-\d{4}-\d{4}-\d{4}\z");
if (regex.IsMatch(val))
{
return;
}
else
{
throw new FormatException("Input string is not in correct format");
}
}
}
The problem is when the instance of SettingSection is created, and the validator is called, the metod Validate is called with empty string - no metter what is the value in the app.config file. If I set the DefaultValue of the ConfigurationProperty attribute, than the validator is called with that value - again regardless to the entry in app.config.
Any idea will be appreciated
Uros
|
|
|
|
|
Hi guys,
I've implemented the code from http://www.neowin.net/forum/lofiversion/index.php/t180600.html[^] into my project (the latest post). Now I wondered: If I go commercial, is the use of the Windows file copy utility legal? This is of great importance, since almost my entire project depends on this code.
Thanks in advance,
Zaegra
Motivation is the key to software development.
|
|
|
|
|
Message Closed
modified 23-Nov-14 6:59am.
|
|
|
|
|
stancrm wrote: I think
I need more certainty than that, but thanks for your reply.
Anyone else knows?
Motivation is the key to software development.
|
|
|
|
|
Zaegra wrote: I've implemented the code from http://www.neowin.net/forum/lofiversion/index.php/t180600.html[^] into my project
If you have implemented code from a different forum, why not ask this question at that forum, as we do not know what their rules are.
|
|
|
|
|
That question is easy to answer: That thread has been abandoned a million years ago, plus, I find the Codeproject a very reliable source of information. That's why I posted the question here, and not there
Motivation is the key to software development.
|
|
|
|
|
Well their site displays no copyright notices apart from for the theme it uses for display. The code is given freely with no copyright notices and is in the public domain so I would say yes - go ahead and use it.
If you want to be absolutely sure, email the site admins to check.
Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Hello! I'm new to C# programming and I have an issue with getting a textbox string to convert to a double.
I'm not sure where I went wrong in the following code, but MS Web Developer isn't liking it:
dEarn = Convert.ToDouble(sEarnings);
dHealth = Convert.ToDouble(txtHealth.Text);
d401k = Convert.ToDouble(txt401k.Text);
I'm trying this two ways: 1) Where "sEarnings" is a string equal to textbox input, and 2) Where I simply try to convert the textbox input directly. Neither way seems to work, and to add clarity, all of this is happening under a Button_Click void.
Thanks!
|
|
|
|
|
Have you looked into using Double.TryParse() instead?
|
|
|
|
|
Tried dEarn = Double.TryParse(sEarnings);... MS Web Developer complains "No overload for method 'TryParse' takes '1' arguments"
|
|
|
|