|
The BitConverter code looks correct. (Just like a cast in C, though, it will give a different answer if the machine has the opposite endianness.) Your code is doing more than just that – what is CheckDigit doing?
|
|
|
|
|
Hi.
Thank you. So How do I check and/or fix the endian?
If it helps, the text I have says that it is stored in little endian byte order, and the following four bytes: 0x22CAFD37 should produce 583728439.
The checkdigit function then calculates and adds a checkdigit so that the above is then:
5837284392
here is the code for check digit...
<pre>uint CheckDigit(uint val)
{
uint sum, copy;
sum = 0;
copy = val;
while (copy !=0)
{
sum += copy % 10;
copy /= 10;
}
return val * 10 + 7 - (sum % 7);
}</pre>
thank you
|
|
|
|
|
On my machine (Windows 32 bit) I'm getting the opposite order:
$BitConverter:GetBytes(5)
(5 0 0 0)
$BitConverter:GetBytes(583728439)
(55 253 202 34)
{x: x:ToString "X2"}¨($BitConverter:GetBytes(583728439))
(37 FD CA 22)
This should be the same in C++, however.
(I can't so easily test the other way around, my toy language doesn't understand about bytes as a native type at the moment.)
|
|
|
|
|
OK,thank you.
I will keep trying on with this.
Steve
|
|
|
|
|
Hi All !
myVal=1365 , and in the String.Format i want to get only Two last digit number(65) .
using with String.Format , any body help to this :
String.Format("{0:00}",myVal); but the output is : 1365
Regards !
|
|
|
|
|
|
thanks , but is it possible with String Format
|
|
|
|
|
Not to my knowledge.
|
|
|
|
|
|
The string.Format method is used to get a string representation of an object in the specified format. It is not intended to change the value of its arguments. You can use
int m = n % 100; to get the last two digits of the number. If at all you have to use strings to achieve the same answer, you can do this
string m = n.ToString().SubString(n.ToString().Length - 2);
|
|
|
|
|
|
if 2 users connect to access and run query that check the last number
increase this number and insert record to database.
Who gets the priority ?
why i see 2 duplicate records with the same number ?
thanks in advance
|
|
|
|
|
It sounds like you need a transaction; that's what they're for.
I also don't recommend Access.
|
|
|
|
|
What you need in this case is an auto-incremented number, such as a primary key, rather than relying on a number field which must be manually incremented. You could also increment the number when inserting the record, not before.
I also agree with PIEBALDconsult, don't use Access. SQL Express is FREE and more robust than Access in multi-user scenarios. It also easier to upgrade to a full SQL Server implementation when necessary.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Mark Nischalke wrote: auto-incremented number
|
|
|
|
|
I need to copy data from mysql via xml to access database. connected to the ProgressBar. database contains multiple tables. is not a tutorial on it some? Thank you for your help. Mark
|
|
|
|
|
Why did you mark your question as a code block?
Make a connection to mysql
create a parameterised query to get the data from the table you want.
save the datatable resultset to xml (this is a waste of time)
close the xml
open the xml
read the data into a datatable
create a connection to the Access database
either write the data to the access tables over the connection.
Apply the values to the progress bar where appropriate.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
In general it is always good to try out something and then post a question here.
You should be able to achieve this using a BackgroundWorker thread.
Too much of heaven can bring you underground
Heaven can always turn around
Too much of heaven, our life is all hell bound
Heaven, the kill that makes no sound
|
|
|
|
|
What is the purpose of the XML stage? You can write code to directly transfer, assuming you have the ability to connect to both databases from a single machine.
|
|
|
|
|
Oslancz wrote: via xml
Probably needless.
In general, to copy data from one table to another (given that the two tables are identical):
0) Create a Connection to the source
1) Open the Connection
2) Use ExecuteScalar to get a count of records to copy, use it as the max value for the ProgressBar
3) Create a Command to select the data from the source
4) ExecuteReader
5) Create a Connection to the destination
6) Use the GetSchemaTable method of the DataReader to cobble up a parameterized insert Command for the destination
7) Open the Connection
8) Begin transaction
9) Read from the DataReader, jump to 14 if done
10) Set the parameter values
11) ExecuteNonQuery
12) Increment the ProgressBar value
13) Jump back to 9
14) Commit or rollback as necessary
15) Close the DataReader
16) Close the Connections
But you'll want to run it on a thread and then you'll need to avoid cross-thread problems.
I also recommend raising an event for each record copied, rather than hard-coding the use of a ProgressBar.
You can also decide how to handle duplicate records and referential integrity problems.
P.S. Furthermore, I would write it as a console application rather than a Windows application, but that's just me.
|
|
|
|
|
i want software that help me to draw forms style to make my clients see it before start design it on visual studio my purpose is to make forms style to clients before begining & to not spend alot of time design forms on visual studio then client edit it
thanks
md_refay
|
|
|
|
|
I don't know of anything like that.
I recommend just roughing it out in Visual Studio so you don't need to redo it all. Are you planning to succeed or to fail?
|
|
|
|
|
i just want to give clients like interface demo to deal on the end interface
so i don't want to spend time design application & redesign it again
md_refay
|
|
|
|
|
|
it take time i need to make PROTOTYPEto dir on clients
md_refay
|
|
|
|