|
Below is the code i use to update the database. I just wanted to know how to write the code to UPDATE database value only if it is smaller than the value of the textbox on the ASP page
public void upOk_click(object sender, EventArgs e)
{
conn.Open();
OleDbCommand cmd = conn.CreateCommand();
cmd.CommandText = "UPDATE [Product]" +
"SET [CurrentBid]" + "='" + priceUpdate.Text + "'"
+
"WHERE [ProductID]=" + idDDL1.SelectedItem.Text;
cmd.ExecuteNonQuery();
DisplayTable();
}
|
|
|
|
|
why are you double posting? Didn't you ask the same question on the asp.net forum?
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
Can anybody help me with the simplest code for playing a sine wave of 200hz using directsound. Runnable in Visual Studio 2008 with directsound as reference.
|
|
|
|
|
Hi,
of course. Here is the skeleton:
public class MySineWavePlayerUsingDirectSound {
public MySineWavePlayerUsingDirectSound() {
}
public void Play(...) {
}
}
So all that is left to do, is reading up on DirectSound and stuffing some code in the skeleton.
BTW don't forget to add the right references.
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
|
|
|
|
|
See this[^] article.
/ravi
|
|
|
|
|
Some applications, like WMP11 or Windows Live messenger, when resizing their window, instead of just having a minimum size or popping out scrollbars when the window gets too small, they seem to have some sort of prio list of which window controls to hide. Do they do this manually in code, or can this behaviour somehow be created via the window forms designer?
|
|
|
|
|
that takes code, it isn't even difficult. All it takes is modifying Bounds and Visible inside a Resize handler.
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
|
|
|
|
|
Hi everyone,
I have a datagridview with some columns of types textbox and combobox, the problem is, every time I build my application, the datagridview thinks it's smart and rearrange my columns for me which drives me crazy!!
Any way to stop that "smart" behavior??
Please help.
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
specifically set the column order in code? i.e. call a function when the form loads or something similar
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
|
My dll file contains private key value. I used this key for encryption. How can I hide this key. If I use Reflector or other tool so show my code. I think obfuscation or post-build not guarantee hide my key value. I use strong key but, it can be remove using with Reflector plug-in. I add dll to GAC but, it easly to steal (Start --> Run ---> C:\windows\assembly\gac_msil).
Do you have any idea?
Best Regards...
|
|
|
|
|
hmmm. not quite sure. but i have just thought of something (maybe a little crazy but hey)
What about writting a small hardcoded algorithm that rearanges the key before using it for decryption/encryption? that way the stored 'key string' cannot be directly used by anybody else. unless of course they can get hold of your hardcoded algorithm. but that is harder than just getting the string, is it not?
instead of your own algorithm, maybe you could just use a hash value of the original key
What you think?
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Dear Musefan;
First of all thanks for care. I have a algorithm like blowfish. I already written hardcoded this algorithm. But most important of this algorithmts need a key. This enuqe key is most important for this algorithm and it will be hide.
Thanks...
|
|
|
|
|
One thing Reflector doesn't show (AFAIK) is class-level fields. Since Reflector treats a const like a field, just put your key in a class-level static const. It can still be retrieved using custom-tailored reflection code, but it should deter casual hackers. I've done this in a private application, which uses a 256-length byte array to encrypt passwords; I couldn't retrieve the value using Reflector
|
|
|
|
|
Which program did you use for ? How can I put my key in a class-level static const.
Dotfuscator Community Edition is not convert variables.
Best Regards...
|
|
|
|
|
I didn't. However, on further analysis it turns out that the value is set from the static constructor of the class. Although it puts off casual crackers, it will not dissuade those who are determined to get the value. By class-level static const, I mean something like this:
internal class Program
{
internal static const string mySecretPassword = "Lorem";
}
However, it cannot compensate for a good obfuscation system and cannot stand on its own
modified on Wednesday, March 11, 2009 12:42 PM
|
|
|
|
|
In your sample not include identifier (for example string), so compiler get error. I try this;
internal class MyClass
{
internal static readonly string mySecretPassword1 = "MySecretKey";
private static readonly string mySecretPassword2 = "MySecretKey";
private const string mySecretPassword3 = "MySecretKey";
internal const string mySecretPassword4 = "MySecretKey";
private static string mySecretPassword5 = "MySecretKey";
internal static string mySecretPassword6 = "MySecretKey";
}
And obfuscation with Dotfuscator Community Edition and Salamander .NET obfuscator. And post build with Xenocode Postbuild 2008 for .NET. But I can see "MySecretKey" when I open obfuscated dll with reflector. In ".cctor()" function.
Note: In C#.NET
const = value assigned at Compile time and unchangeable once established.
readonly = value assigned at run time and unchangeable once established.
|
|
|
|
|
Whoops; I've added string to the code sample. As I said, all that my method does is hide it from a cursory look. It cannot compensate for a dedicated obfuscation package. I have chosen the const keyword because it simply provides safety in case I ever go past the ballmer peak and change its value; my choice was quite deliberate
|
|
|
|
|
A decent obfuscation tool (NOT the one that comes with Visual Studio) will encrypt strings so reflector doesn't show anything useful.
"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 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Which one is better;
Dotfuscator Professional (preemptive)
Salamander .NET obfuscator (remotesoft)
And what is your think about post-build? Do you use Xenocode Postbuild?
Best Regards...
|
|
|
|
|
You're planning to combine relatively insecure ways to hide a key with a very strong encryption algorithm? That strikes me as odd - it's a bit like having 10 locks on your door but putting the key under the doormat.
|
|
|
|
|
I second this comment!
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Good call.
If you were using crypto appropriately, then you wouldnt need to hide the key that the user is going to use.
Alice can't send a secret message to Bob and then have Bob read it sometimes, but not other times. Maths doesnt work that way...
|
|
|
|
|
Ok. How can I Blowfish, Twofish or AES algorithims in ASP.NET project. All of them needs private key.
|
|
|
|
|
You can use them, but you should only use them to encrypt a communication channel. Anything else is not "encryptable" - you may try but it still won't be safe, no matter what.
|
|
|
|