|
Bonsta wrote: Im trying to compare the password entered on textbox to password in SQL Server..
returns a error
Can you be more specific about the error that you are getting?
|
|
|
|
|
Looks like you have password in plain-text since it looks as if you have the user enter a password in the textBox2. This is not good practice. I'd look at cryptography algorithms before continuing on.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
I have a SQL 2005 Database that has a Table called User that stores users of the application and their passwords and access levels...
I want to:
1)retrieve the pasword for the Username entered on the textbox1.(if username not found show Error)
2)check retrieved password against the password entered on textbox2
3)if they match, open next form(Form4())
I have been looking for articles on the site, but have not been successful...If there is a simpler way plz help.
Thanks in advance.....;)
Is this chair taken
|
|
|
|
|
Bonsta wrote: check retrieved password against the password entered on textbox2
Like I said before, not a good idea having password in plain text. Have it encrypted on the database side, and characters masked out in the textbox. When doing the check, encrypt the textbox text to a temporary string and then compare against the database.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Is there a way to display an additional dialog in the Setup project generated by Visual Studio 2003?
I want to display a dialog which will require the user to enter installation password. The dialog would first have to generate a random string, and then check if the password is the right one for that string. I have allready made that dialog, so my problem is the following:
I have tried two things:
1) I created an Installer class, and overriden the OnBeforeInstall method, to display my dialog. Then I added the compiled FormDialog.EXE as a Custom Action in the Setup project. However, the dialog appears during the Installation Progress, when the progress meter shows that the installation is almost complete. And I wanted it to display before the progress bar is shown, so that the installation would not start before entering the password.
2) I added a "Textboxes (A)" dialog in the user interface of the Setup project. But, I do not know how to make the setup generate the random string, and check if the password is correct, since I am not able to make any Installer class run before the progress bar of the installation is shown.
Is there a way to run a Custom Action before the Progress screen is show?
And can I make it change value of a TextBox in "Textboxes (A)" dialog?
Thanks
|
|
|
|
|
Custom actions will always run after the installation is completed when the progress bar reaches 100%.
As for adding a custom screen it is possible and you will have to edit the MSI database using a tool called Orca.
Be warned using Orca is a real pain in the butt. I'm surprised MS hasn't done much in this area with Visual Studio.
I will give you a refernce to a codeproject article that discusses addition of a custom installation screen before the installation actually takes place. The article should give you an idea "what" is involved with MSI editing and adding a custom screen.
http://www.codeproject.com/useritems/ChangeVDirWebSetupProject.asp?msg=1631151&Page=2&userid=1785827&mode=all#xx1631151xx[^]
Finally, you can investigate WIX- Windows Installer XML. This stuff is really freaking cool.
|
|
|
|
|
Hi all,
I want to have only vertical scrollbar in my listview .
Can anyone please tell me how can i do it?
Please provide code.
Praveen Sharma
|
|
|
|
|
Hello
I am messing around making things that tell the time zone and other things to learn c #
I was wandering when you see a console app with numbers eg
1. get time zone
2. get date and time
3 etc
how do you do such a menu
Thanks for the help
Mark
Noobster
|
|
|
|
|
static void Main(string[] args)
{
Console.WriteLine("Input number and press ENTER to choose option:");
bool loop = true;
while (loop) {
Console.WriteLine("0 - Exit");
Console.WriteLine("1 - Get Time Zone");
Console.WriteLine("2 - Get Date and Time");
switch (Console.ReadLine()) {
case "0":
loop = false;
break;
case "1":
Console.WriteLine(System.TimeZone.CurrentTimeZone.StandardName);
break;
case "2":
Console.WriteLine(DateTime.Now.ToLongDateString() + ", " + DateTime.Now.ToLongTimeString());
break;
default:
break;
}
}
}
Hope this'll help
Greetings - Gajatko
|
|
|
|
|
wow i was thinking of making variables for each option then having a if statement haha
i guess switch is better for more options..
trying to grasp the bool loop = true;
it keeps asking me once i pick a answer i guess instead of writing a bunch of Console.WriteLine(); cool
Good stuff my brain is frying today lol
|
|
|
|
|
I use "loop " variable instead of just "true " to avoid goto statement. In the case "0" a statement "double break" whould do the trick, but there isn't such thing. So set the variable to false and the next loop will not evaluate.
Greetings - Gajatko
|
|
|
|
|
Hi!
how can initialize attributes?
and how can i read the data from a specific one, not in a search!!
Thanks
|
|
|
|
|
Hi all!
Via Environment.TickCount I can get time elapsed since system started. How could I get time elapsed since user logged in? An array containing all users who log in since the system starts last time and how long they stayed would be the best.
Greetings - Gajatko
|
|
|
|
|
it can be done using WMI (System.Management namespace),I don't know but maybe .NET has some classes which give you these info.
with WMI
you can retrieve these data through Win32_LogonSession and Win32_LoggedOnUser and extract start time from them.
with subtracting from DateTime.Now you'll have the duration
it would be somewhat like this
class UserLogonData
{
const string ALLUSERS = "All";
readonly string userName;
readonly DateTime loggedOnTime;
string logonId;
public string UserName
{
get { return this.userName; }
}
public DateTime LoggedOnTime
{
get { return this.loggedOnTime; }
}
public string LogonID
{
get { return this.logonId; }
}
public TimeSpan LoggedDuration
{
get { return DateTime.Now.Subtract(this.loggedOnTime); }
}
private UserLogonData(string userName, string logonId, DateTime loggedOnTime)
{
this.userName = userName;
this.logonId = logonId;
this.loggedOnTime = loggedOnTime;
}
public override string ToString()
{
return this.userName;
}
public static UserLogonData[] GetUsersLogonTime(string userName)
{
List<UserLogonData> dataList = new List<UserLogonData>();
ManagementObjectSearcher mosUser = new ManagementObjectSearcher(new SelectQuery("Win32_LoggedOnUser"));
ManagementObjectSearcher mosSession = new ManagementObjectSearcher(new SelectQuery("Win32_LogonSession"));
ManagementObjectCollection mocUser = mosUser.Get();
ManagementObjectCollection mocSession = mosSession.Get();
foreach (ManagementObject moUser in mocUser)
{
string userLogonAntecedentData = moUser.Properties["Antecedent"].Value.ToString();
string userLogonUserName = Regex.Replace(userLogonAntecedentData, @".*Name=""(?'name'.+)"".*", "${name}");
if (userName!=ALLUSERS && userLogonUserName != userName) continue;
string userLogonDependentData = moUser.Properties["Dependent"].Value.ToString();
string userLogonSessionId = Regex.Replace(userLogonDependentData, @".*LogonId=""(?'id'\d+)"".*", "${id}");
foreach (ManagementObject moSession in mocSession)
{
string sessionLogonId = moSession.Properties["LogonId"].Value.ToString();
if (sessionLogonId == userLogonSessionId)
{
string dateTime = moSession.Properties["StartTime"].Value.ToString();
string formattedDateTime = Regex.Replace(dateTime,
@"(?'year'\d{4})(?'month'\d{2})(?'day'\d{2})(?'hour'\d{2})(?'min'\d{2})(?'sec'\d{2})\.(?'mil'\d{0,3}).*",
@"${year}/${month}/${day} ${hour}:${min}:${sec}.${mil}");
dataList.Add(new UserLogonData(userLogonUserName,userLogonSessionId
,DateTime.Parse(formattedDateTime)));
}
}
}
return dataList.ToArray();
}
public static UserLogonData[] GetUsersLogonTime()
{
return GetUsersLogonTime(ALLUSERS);
}
}
hope the post would be useful
good luck
|
|
|
|
|
Thank you, thank you and thank you!
1 ) What about this situation:
(current user time line)
SYSTEM START>------|------------|--------|----------|------->NOW
user A|user B |user C |user B |user A
where "|" is a logout/switch operation.
And I want to calculate how long the user A used computer. Your Duration property calculates duration assuming that all these users are STILL logged in.
I suppose a property "LogOutTime " would do that.
2 ) How do you know that?? Please post some knowledge source - I couldn't find it anywhere.
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
unfortunately it seems there is no LogOutTime property (at least I didn't found out anyOne)
but AFAIK In windows only on user can work at the same time
so there is a class in .NET name Microsoft.Win32.SystemEvents.SessionEnding it happens when a user trying to logoff or shutdown
so you can find active user through WMI again or through System.Environment.UserName
and find you are in which session.
I think with adding the event to the class you can find total duration.(but it needs your program always run or atleaset when user is going to logout or shutdown)
if you get the duration inside the method associated with that event it would be total user log time.
ofcourse there is another approaches like looking inside eventlogs but i think this is the easiest one
hope the post would be useful
|
|
|
|
|
Thanks!
However it seems to be difficult to get a real duration because of Windows hibernate service.
UserLogonData.GetUsersLogonTime(Environment.UserName) returns an array which contains two items. NOW it looks like I'm sitting on this chair for
LoggedDuration {1.04:01:07} - from yesterday evening, when Windows was hibernated (28 hours?? Oh God...).
or
LoggedDuration {01:49:33.6101250} - today (almost two hours, not so bad)
?
"AFAIK In windows only on user can work at the same time":
Yes, but more than one may be logged in at the same time AND one user can work more than one time in the single system session (if e.g. some other guy kicked him out for a while because he "just wanted to check mailbox", but after that that guy could return back -- and I want to know how (totally) this first guy was sitting on the chair).
Greetings - Gajatko
Portable.NET is part of DotGNU, a project to build a complete Free Software replacement for .NET - a system that truly belongs to the developers.
|
|
|
|
|
first sorry for delay I was in vacation
yes you're right it cannot be done as straight as a simple win App
but with services you can, and writing services in .NET is not harder than writing simple winApp
it can be done with services because they'll works even when a user switch or logoff.
and I think you must log some data byyourself if you need accurate times (like finding hibernate time and subtract it and ...)
gajatko wrote: if e.g. some other guy kicked him out for a while because he "just wanted to check mailbox", but after that that guy could return back
there is another event in SystemEvents Class name SessionSwitch it will occur when the user going to change so I think UserSwitch would be included and when you hibernate it seems something like userSwitch happens (but I'm not sure) so maybe this event would be useful.
gajatko wrote: from yesterday evening, when Windows was hibernated (28 hours?? Oh God...).
another event is PowerModeChanged which will return your computer is going to suspend mode or not and hibernate is counted as a suspend mode (atleast in .NET)this event may help to retrieve hibernate status too.
and at last I think you can retrieve some data from the Service status (like Puase/Stop) and use it for finding machine state like shutdown hibernate
good luck
|
|
|
|
|
hi
i have a Main_form and Detail_form.
in my Main_form, i have a public method as 'LoadData' to load data and show it in gridView, here is my method code :
public void LoadData()<br />
{<br />
this.gridControl1.DataSource = null;<br />
DataAccess.Command.CommandText = "SELECT * FROM v_fish_grid";<br />
DataAccess.Command.CommandType = System.Data.CommandType.Text; <br />
if (DataAccess.Connection.State == ConnectionState.Closed)<br />
DataAccess.Connection.Open();<br />
DataAccess.Reader = DataAccess.Command.ExecuteReader();<br />
this.dt.Load(DataAccess.Reader);<br />
DataAccess.Reader.Close();<br />
if (DataAccess.Connection.State == ConnectionState.Open)<br />
DataAccess.Connection.Close();<br />
this.gridControl1.DataSource = this.dt.DefaultView;<br />
}
in Detail_form, i want when user insert,update or delete data,call the LoadData method in Main_form from Detail_form, i do this but my gridView's records was not update(i trace my LoadData method in runTime and dt object get recoreds but i don't know why my data does not load in gridView)
How to solve My problem ? thanks
|
|
|
|
|
I want to create and element with data, like this:
<Song FileName="DJ Style & MC Loran - Ragga Pumpin [Promo Mix].mp3" FileSize="8782157" TagDate="511031848">
<Infos SongLength="16136064" Date="511031848" />
</Song>
How can i create the FileName and the FileSize, and how can i get them from another node?
Thanks
|
|
|
|
|
When searching for nodes using XPath, use @ to specify that you're searching an attribute.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Don't start new threads all the time: when the topic continues to be the same, as
is obvious from your post, add a message to your earlier thread.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
when you can't help me, why post here ?
|
|
|
|
|
hdv212 wrote: when you can't help me, why post here ?
With over 300 messages posted, you should already be aware it is considered
rude to start a new thread unnecessarily, to modify a message without marking
it as modified, as well as to delete a message once it has one or more replies.
At the time I could not help you, since your message seemed empty;
now I can't because it's gone.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Luc Pattyn wrote: Don't start new threads all the time: when the topic continues to be the same
Geeze, that is still going on around here
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|