|
A few things to consider...
Make sure to use a parameterized query (preferably a stored proc) instead of just a plain query string. I.e.
cmd.CommandText = "usp_GetUserInformation";
cmd.Parameters.Add("@userName", userName); //from username_txt.Text
instead of ...
cmd.CommandText = "select UserName, Password from Users where UserName = '" + username_txt.Text + "'";
The reason for this is to prevent SQL injection attacks.
Another thing...
Don't store the password in plain text in the database. When the user sets up the password, hash it and store the hash. Then when checking the password, hash what they enter the same way and compare it to what is in the db.
Jeff Martin
My Blog
|
|
|
|
|
Hi all,
I need to read the system time and write it to text file when ever the user presses some alphabet keys.
thanks for anykind of help,
Pavan.
Suman
|
|
|
|
|
|
Hi,
thanks for ur reply... if u dont mind can u give me a precise command... i need to read the time upto milliseconds... like hh:mm:ss:ms.... i saw tht tickcounts will do tht but i didnt understand how to use it.
Can u please help me out on this....
Thanks in advance,
Pavan
|
|
|
|
|
how about this.
DateTime[^]
FileStream[^]
You have to start by reading the docs, right?
There are code examples and useful links in both the above docs, if and when you get stuck on a particular part please post again.
|
|
|
|
|
thanks for ur links, i do have gone through them. But i didnt get how to read the time upto NANO or MILLI seconds at the particular instance when we press a specified key on the keyboard, which is the only problem i am having.
I want the format to be like... hh:mm:ss:ms (where ms is milliseconds)
The millisecond property is not related to the system time while it is related to the instance of the application.
it would be greatful if anyone can help me on tht.
thanks,
Suman
|
|
|
|
|
Does anybody know where I can get modern looking bitmaps for commonly used buttons like Bold, Italic, Underline, Undo/Redo, etc.?
Thanks
Eric
|
|
|
|
|
|
|
Hi:
I am currently going through a Wrox book "Professional C++, 2nd Edition". I have been typing in the example code myself and have encountered a strange problem.
Each time an example program uses a "MessageBox" call, the message box is launched, but there is no print on it. The button is there, and it works as expected when you click it but there is no text on the box window OR the push-button.
As a sanity check, I created a basic Windows App using the app wizard. I made one single change to the code: In the constructor for Form1, right after the call to "InitializeComponents", I added the line:
MessageBox("Hello ?");
Same result.
I am using Visual Studio.NET V7.0 with .NET Framework 1.1.4322 SP1. I am running on Windows XP-Pro with all of the latest service packs. I have also transfered the executable code from some of these programs to another machine with the same results.
Has anybody out there had this problem? Any idea what might be going on?
Thanks in advance for you help
Mark
|
|
|
|
|
I can't say that I've ever seen that, but can you confirm, what language are you working in? You said the book you are reading is "Professional C++, 2nd Edition", this is the C# forum. From the looks of your code it does appear to be C++, however you should check the function parameters. The following example I threw together works fine in Visual Studio .NET 2003 using unmanaged C++.
#include "stdafx.h"
#include <windows.h>
int _tmain(int argc, _TCHAR* argv[])
{
MessageBox(NULL, "Hello", "Test", MB_OK);
return 0;
}
|
|
|
|
|
Hi Nick:
Sorry, that was a typo. It IS C# I am talking about and the book is "Professional C#, 2nd Edition."
I have worked through examples where I launch the MessageBox from a push-button handler, from event handlers and event from simple console applications, similar to what you have done above but in C# of course. I get the same result.
In fact, here's a console program that I used:
using System;
namespace Learn.CSharp.MessageBoxTest<br />
{<br />
class MainEntryPoint<br />
{<br />
public static void Main()<br />
{<br />
MessageBox.Show( "Console App", "Hello there!", MessageBoxButtons.OK );<br />
}<br />
}<br />
}
Any ideas?
Thanks,
Mark
|
|
|
|
|
The MessageBox class is defined within the System.Windows.Forms namespace. Assuming that your project has already included a reference to the appropriate assembly, just include it in the using statement:
using System;
using System.Windows.Forms;
namespace Learn.CSharp.MessageBoxTest
{
class MainEntryPoint
{
public static void Main()
{
MessageBox.Show("Console App", "Hello there!", MessageBoxButtons.OK);
}
}
}
|
|
|
|
|
Hi Nick:
The code snippet I provided was missing the "using System.Windows.Forms;" statement but the program I was running was not. The exact program that you recommend in your last response still has the same problem....
Regards,
Mark
|
|
|
|
|
Hi Nick:
This is just a "FYI" type of message:
I finally solved the mystery of the blank message box under .NET. A guy from "Code Guru" tipped me off:
The problem was McAfee Anti Virus V8.0. If you have buffer overflow protection enabled, this will cause the problem I described. Disable BOP or run a hot-fix and the problem disappears.
Cheers,
Mark
|
|
|
|
|
i am developing an application for my final year project, that generate barcodes. my problem is that i want to tell the program to draw a black bar when I enter the number "1" for example, or two black bars when I enter "2"...etc. Could anyone help ?!
Thanks in advance
|
|
|
|
|
|
Hello,
I'm developing an add-in for Word2003 and I have some troubles. I’m using VS .NET 2003 ->extensibility project.
The add-in works fine with the first document in Word I create/open but after It fails, the add-in doesn’t work anymore.
I’m looking for an add-in source code, to see why I always have the same problem, where is the mistake…
In fact all the events (OnConnection, OnDisconnection, etc) only fires with the first document created/opened.
All the source codes I found, didn’t worked…So I’m looking for a complete example source code (in c# .NET)
Do you know where I could find It? Or why does my add-in only works with the first “instance” of Word.
Thanks a lot,
Frenchy
PS: Sorry for my bad English :p
|
|
|
|
|
Are you performing any exception handling in your code? Try settings some break points and stepping through the code during execution to see where it's failing.
|
|
|
|
|
Yes I put try/catch everywhere, as I said, all the events(OnConnection, OnDisconnection, ...) only fire the first time.
All my code is in these events, that's certenly why it doesn't work.
The commandbar with the buttons I created in the "OnConnection" is still in the second document, but the actions, the code doesn't work.
If someone have a complete source code for Word add-in, please tell me where I could find It Or you can send me by mail; frechy@msn.com
Thanks
|
|
|
|
|
My boss wants me to develop an application to capture a live video stream from a local selectable video source, so for instance a web cam or a TV tuner, depending on the situation. He does not however want me using DirectX. Does anyone have any other suggestions as to how to do this. I was thinking of using the windows media encoder but that seems to be a little over kill. Any Suggestions?
|
|
|
|
|
Hello
You can try to use Video for Windows. But, as it said in MSDN :
"VFW was introduced in 16-bit Windows. Many of its features has been superceded by features in DirectX. For more information, see the DirectX documentation."
So, it's better to use DirectX.
What is the point of your boss ? Why it's not likely to use DirectX ?
Andrew
|
|
|
|
|
I wrote a program with c# and ms-sql 2000.To connection strig I put my server's name as usual.But when I want to try my program on other computer since the server's name changes the connection string have to be changed.Is there any way that prevent changing string every time I change computer or servername? Is there any way that connection string automatically updates it self?
|
|
|
|
|
show us the connection string you're using minus username and password if you dont want us hacking you
|
|
|
|
|