|
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
Thanks everyone for the suggestions. They have helped get started but the criteria has changed. I now need to support the following conditions:
1. a value of N/A only in the field => N/A
2. a numeric value with decimal points => 24.231
3. a numeric value that can begin with < character => < 12.1, or < .5
4. a numeric value that can begin with > character => > 27.2, or > .5
|
|
|
|
|
Before we go any further, let's settle on the spec.
Is N/A required to be uppercase? Are any or all of n/a N/a n/A acceptable?
From your example, .12 is OK. What about 13. ?
Is an integer value like 123 (no decimal point) allowed?
Are there limits on the number of digits (total/before/after the decimal point)?
Your answers to these questions do not affect the solvability of the problem (the existence of a suitable regex), but they do affect the solution (the value of the regex).
Cheers,
Peter
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
Basically, I have a field that either can take an integer value up to 3 digits or a decimal value with up to 2 decimal places. I change the mask in code before the screen is displayed. Below is an example of the existing masks.
TextBox1.Mask ='\d?\d?\d?';
OR
TextBox1.Mask = '\d+.\d?\d?';
Now, I need to have the integer mask have the ability to accept a <, > or N/A as well as to have the decimal mask do the same. I need it in two masks because I dont want certain fields to be able to enter decimal values and other fields to have the ability.
I also can set the textbox to foce upper case for (N/A) and set a max length if needed.
|
|
|
|
|
OK. Here are a couple:
*note* these are regexes, which may or may not be suitable for use directly in a maskedit control mask field.
integer, 1 - 3 digits with N/A < >
^(N/A)|([<>]?\d{1,3})$
float, 0 - 2 decimal places, with the same extras
^(N/A)|([<>]?\d+\.\d{0,2})$
This one requires at least one digit before the decimal point. If you want to allow .12 change the + in the middle to * .
Following the "teach a man to fish" philosophy, I strongly recommend you get yourself a copy of the free tool Expresso[^]
(I have no connection to Ultrapico other than as a very satisfied user.)
Cheers,
Peter
[edit] added *note* [/edit]
Software rusts. Simon Stephenson, ca 1994.
modified on Wednesday, August 3, 2011 9:17 PM
|
|
|
|
|
Thanks for the assistance and thanks for the link to Expresso.
|
|
|
|
|
hi to every one
i try to use ozf2 or ozf3 file in my application
is there any way to use this files with C#?
i know the ozf file is indexed image file with it we can load part of image in memory
but how can do that?
i want use this image for GPS map file
if can't do this is there any other way to load GPS map?
|
|
|
|
|
mohsen-unique wrote: is there any way to use this files with C#?
Yes, always. A file is just a bunch of bytes, nothing stops you from using them.
I have no idea what a ozf2 files looks like inside though.
|
|
|
|
|
the ozf2 file is a kind of file for map that used in oziexplorer program.this program in gps tracking
for more information about oziexplorer go to http://www.oziexplorer3.com/[^]
|
|
|
|
|
Ok, I can't find any useful information there though - such as the structure of the file.
|
|
|
|
|
i have same problem i can't found any information about structure of the file
|
|
|
|
|
So what are you trying to do? Crack open the files so that you can extract the underlying maps?
|
|
|
|
|
na i want use the ozf file for my application that load map file and show the location of user from GPS device
|
|
|
|
|
It looks like this file format was invented by the author for his application. I doubt you'll find it readily available anywhere I'm afraid.
|
|
|
|
|
|
hi
i have this code for update datetime fileds in access using params
SQL = "update ConfTbl set D_from = @MyFrom , D_to = @MyTo where Code = " + Convert.ToInt32(TmpCode1) + "";
OleDbCommand Cmd = Conn.CreateCommand();
OleDbParameter dateparam1 = Cmd.Parameters.AddWithValue("@MyFrom", DbType.DateTime);
dateparam1.Value = dt_From.Value;
OleDbParameter dateparam2 = Cmd.Parameters.AddWithValue("@MyTo", DbType.DateTime);
dateparam2.Value = dt_To.Value;
Cmd.CommandText = SQL;
Cmd.ExecuteNonQuery();
how to change this for run query that find between two dates ?
somthing like: `select * from ConfTbl where Tdate >= #MyFrom# and Tdate <= #MyTo#`
thanks in advance
|
|
|
|
|
One, this seems related to what you posted directly below. Edit the original, don't start a new thread.
Two, FORMAT your code snippets!!!
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
hi
i have in my access datetime filed that hold date in short format in this format: `01/08/2011`
i have in my C# program datetimePicker that hold date in this format:
`dt_from_A.Value.ToShortDateString()` and hold `01/08/2011`
i try to run this query :
SELECT * FROM ReturnConfTbl where Tdate >= #01/08/2011# and Tdate <= #01/08/2011#
but i dont receive any records
|
|
|
|
|
in sql server, both of those dates default the time to midnight, not sure bout other db's but i assume its the same. If all you have is the one date you can use a some DATEADD function to add a day to it and just make the query Tdate < date + 1. all the db's i've seen have some form of that function as do most popular languages..even javascript can do it.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
goldsoft wrote: filed that hold date in short format in this format: `01/08/2011`
Don't store dates as text/char; use a proper date/datetime datatype.
goldsoft wrote: and hold `01/08/2011`
No, it holds a proper DateTime value; it simply displays the value in that format (or any other).
goldsoft wrote: >= #01/08/2011# and Tdate <= #01/08/2011#
Use a parameterized query.
Those two values are the same, so you will only get rows with exactly that value. You could use the AddDays method of the DateTime type to calculate the second value.
|
|
|
|
|
As PIEBALDconsult said, store dates and times in a proper DateTime, and hand them through as parameters.
It is also worth noting that Access (like every other database I have seen) uses ISO format for dates anyway: yyyy-MM-dd so the query you tried would not work as the date format would cause an error.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
This is a SQL question, not a C# question.
You want to use the BETWEEN keyword in your SQL query:
select * from table where table1.datecolumn BETWEEN date1 AND date2
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
what is the right way to fetch only one record from the table where many records of same types exist there ?
|
|
|
|
|
Because you asked in this forum, rather than the Database forum, I assume you mean a DataTable, not a database table, where an SQL solution would be appropriate, so I will recommend you look at Linq and select and take in particular.
If you are looking for SQL please post in the Database forum. I'll still help you there, although I should be asleep already.
|
|
|
|
|
The generic answer is to use a cursor .
Specifically it really depends on the database engine - for instance in Oracle PL/SQL you can use a loop command to iterate through a table.
Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
|
|
|
|