|
Hi All.
I have written an application with a logon form. Previously I used to hardcode the users logon details withing the code. The problem I have with my current project is that I could possibly have upto 100 users and would have to add or remove users from time to time. I am using an Access DB with the application. I want to create a table in the DB to store the Users details.
My problem is that I am not sure how to check the details entered on the logon form back to the DB. Below is what I currently have. Can somebody please help me change the below so that it rather reads through a table in the db to check the users details. Once the details have been verified it should then go onto opening the main form of the application. Any help or advice with this would be greatly appreciated.
private void btnLogon_Click(object sender, EventArgs e)
{
MainApp mnapp = new MainApp();
if (txtboxUserName.Text == "user1" && txtboxPassword.Text == "user1pwd"
||txtboxUserName.Text == "user2" && txtboxPassword.Text == "user2pwd")
{
this.DialogResult = DialogResult.OK;
}
else MessageBox.Show("Invalid username and or password supplied", "Logon Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
|
|
|
|
|
I have two applications(projects) say A and B. A accessed a data from database only once and store in hashtable. Is there any way so that i can pass hashtable or any object to app B? Whether I have to use some server/client architecture? Suggest me any simple method.
thanks in advance
|
|
|
|
|
Well, there's things like shared memory, named pipes, or just connect to yourself using sockets.
Named pipes and sockets would probably be the best, and last time i wanted to use pipes in C# i think i had to import the methods from one of the DLLs. That leaves sockets as probably the easiest option.
There's probably more stuff, but i havn't needed to use it, so i don't know about it
My current favourite word is: Nipple!
-SK Genius
|
|
|
|
|
I have used sockets but can i pass objects also, like hashtable?
|
|
|
|
|
Are they both exes? Sounds like a standard n-tier app otherwise.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Yes. A is having capability of accessing huge data so that whenever I used to debug B there will be no need to load that much of data every time. So i just want to load data in App A, and further accessed by B.
|
|
|
|
|
In which case then probably sockets would be a good choice, but I would look at the overall architecture as it sounds like application A is really a data server. Potential for web service perhaps?
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hmm. Sounds like a job for WCF (Windows Communication Foundation). This opens up many different types of bindings for you.
|
|
|
|
|
class Program
{
static void Main(string[] args)
{
Dictionary<book,object> entries = new Dictionary<book, object="">();
entries[new Book("C# Cookbook", 234)] = null;
entries[new Book("ADO.NET Cookbook", 277)] = null;
entries[new Book(".NET Framework", 455)] =null;
entries[new Book("Windows Forms", 873)] = null;
getproperties(entries,"books");
}
private static Dictionary < Book,object > getproperties(Dictionary< Book,object> entries,string myString)
{
//Return new dicitonary of type Dictionary < Book,object> which has myString in as value and entries as book
}
}
class Book
{
private string m_Title;
public string Title
{
get { return m_Title; }
set { m_Title = value; }
}
private int m_Pages;
public int Pages
{
get { return m_Pages; }
set { m_Pages = value; }
}
public Book(string title, int pages)
{
m_Title = title;
m_Pages = pages;
}
public string Display()
{
return String.Format("{0} ({1} pages)", m_Title, m_Pages);
}
}
|
|
|
|
|
So, Queer-Boy, er, Justin Timberlake, what's your specific problem you have had in implementing this yourself?
I'm going to become rich when I create a device that allows me to punch people in the face over the internet.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
|
|
|
|
|
I am unable to modify the value of dicitonry iterating all the keys using foreach loop
|
|
|
|
|
Right, you're not allowed to modify a collection while you're using foreach , but you could try a regular for loop.
I didn't think there was anything you could do worse than sing, but you have exceeded my expectations.
|
|
|
|
|
I wanted to this .............. i got it this moring
private static Dictionary<book,object> getproperties(Dictionary<book,object> entries,string anyString)
{
Dictionary<book, object=""> mydict = new Dictionary<book, object="">();
/// Dictionary<book, object=""> d = new Dictionary<book, object="">();
foreach (Book mybook in entries.Keys)
{
mydict[mybook] = anyString;
}
return mydict;
}
|
|
|
|
|
And what is the error your getting when you try to do that?
It looks like your trying to copy the entries from one dictionary to another? If so, you should probably be using the Add() method instead of trying to do this through the indexer.
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
i want to see a whole xml file in the richtext box. how can i see it or access it?
|
|
|
|
|
Use XmlDocument to load it - and then bind the text to the textbox.
|
|
|
|
|
plzzzzzz explain through code , i dint get you
thanks
|
|
|
|
|
|
Google "reading text file in C#", this is basic IO. It's a text file, look at the StreamReader , (or even the XmlTextReader if you really need it, though it doesn't sound like you do).
|
|
|
|
|
how do i create a line graph using c#, values will be in sql table???
|
|
|
|
|
Use a graph control. Read the point values out of the database and bind them to the graph.
|
|
|
|
|
how can i programatically search node in the treeview? and if i am accessing xml file in treeview, then how can i search the node in xml file too?
|
|
|
|
|
its urgent plz help meeeeeeeee
|
|
|
|
|
samidhas wrote: its urgent plz help meeeeeeeee
Tut tut. It's always urgent. Saying this is just plain rude and inconsiderate. Why do you think your requirements are any more urgent than all of the other posters?
This is a volunteer only forum, so you have to be patient and wait for the relevant volunteers to get round to answering your questions. Pestering people and posting crap like this makes it less likely that you will get help. We get very annoyed at people with attitudes like this.
|
|
|
|
|
Create a method that recursively searches through the ChildNodes in your treeview. To do this, pass the top most node in and then do a foreach on the ChildNodes, and if you haven't met your criteria recursively call the same method passing in the ChildNode that you are iterating over.
|
|
|
|