Re: [RESOLVED] Starting Database....
You can go way of asp.net and mebership provider, or do it youself with SQL query to DB. In this case, you will need DbConnection (SqlConnection?) and DbCommand executed with ExecuteReader() method of it.
Re: Starting Database....
Thanks You for your suggestion....Here is a Updated Program...please have a look through it....
I managed to validate user through the database data but i need help for changing and updating data and database........
I am having a problem in the second window where I want to change password over writing the current password in the data base.....
Re: [RESOLVED] Starting Database....
Do you need it to be with a DB? If it is a single user/pass account it can be easilly saved in binary file. I have a similar project - on first run it creates an account (user chosen user and pass) and on each other run, you need to use the user and pass you have chosen to get to form2.
If that would be any help I can provide you with the source code of my project.
Re: [RESOLVED] Starting Database....
Yes I would surely like to see that....Please Upload it here.....On the Other Hand I used database Because I have a plan of extending this application and I surely need the database on that so that I can only add a table to it....any oh! it would be great if I can see your application...Thanks
Re: [RESOLVED] Starting Database....
Someone have suggested me the following code for solving my problem..but it is not updating the data base at all even though it does not give any error at compile or runtime....please have a look at this l...
Code:
private void button1_Click(object sender, RoutedEventArgs e)
{
using (var db = new DataClasses1DataContext())
{
var user = db.usrInfo_tables.SingleOrDefault(c => c.Username == txt_usrname.Text.Trim() && c.Password == txt_oldpass.Text.Trim());
if (user == null)
{
MessageBox.Show("Incorrect Username or Old Password!!");
return;
}
user.Password = txt_newpass.Text.Trim();
db.SubmitChanges();
}
}
1 Attachment(s)
Re: [RESOLVED] Starting Database....
Here is the login modul. I am pretty sure that you can use this file instead of DB, but I am not advance enough to tell you how..
Also check this code, wrote it fast just to show u what i meant:
private void button3_Click(object sender, EventArgs e)
{
string username = textBox1.Text;
string password = textBox2.Text;
string username1, password1;
var db = new databaseDataContext();
var user = db.Users.Single(a => a.ID == 1); // get the user with ID = 1
username1 = user.Username;
password1 = user.Password;
if ((username == username1) && (password == password1))
{
MessageBox.Show("OK");
}
You need to change the ID for the account to 1 for this to work.