Hello everyone,
I am having a bit of a problem connecting to a MS Database in C#2005.
I have written my app befor as a test bed for the whole programme but I used a simple XML file to strore the username and password details. Now that the application is near compleation I would like to use a MS Access DB for the same purpose.
The problem I have is I can connect to the DB in solution explorer and I can creat the DataSet but where do I go from hear. I have tried a few things but none seem to work.
Any hints or pointers would be greatly received.
With thanks in advance.
Scott

MS Access DB for user logon details
rahul_sabharwal
Hi everyone,
If every thing is in track, why when I follow the code through using the breakpoint option does my application go to the database, but still come back with no data.
Its almost as if the data does not exist in the database or the dataset.
Any points or ideas would be greatfully recieved.
Thanks again
Scott
NeonICE
hi,
i don't think SQlClient can be used with access database i think you need OleDB thats if you want to connect to your database programmaticly
or other wise you have to creat a tableadapter and fill your dataset from your database when your form is loaded
from your datasource drag a table to your form and go to the designer and watch which code was added for you
more over this thread has a nice tutorials
http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=212562&SiteID=1
hope this helps
ramamoorthi
Hello Sibusiso,
Thanks for the post, sorry I havn't marked it as an answer but I have been away for a bit. I should be able to look at the code over the weekend and I'll let you know the outcome.
Once again thanks for the help
Scott
Liatush
Hi
Try this and see what happens
kMatsupy
Hello everyone,
I just went back over my code using the Set In option. I now know that the programme is looking at the database, but for some reason is not pulling up the data for the validation.
Could this be due to the fact that I put a password on my database
cyWrenDave
Hi Sibusiso,
Thanks for answering, I will try to provide as much detail as possible:
I have added the database to my solution (lets call it db1.mdb)
I have dragged a bindingSource (lets call it bindingsource1) to the windows form (lets call it Form1.cs) and bound it to my database sellecting the dataset that was created when I added db1.mdb to my solution. This then added the db1DataSet to my IDE veiw.
In the code for my "LogOn" button event I have written the following code.
private void btn_ok_Click(object sender, EventArgs e){
Username =
this.txt_username.Text;Password =
this.txt_password.Text; if((db1DataSet.users.usernameColumn.Equals(Username)) && (db1DataSet.users.passwordColumn.Equals(Password)){
main frm=new main(); this.Hide();frm.Show();
}
else MessageBox.Show("Your log on credentials have not been recognised."+"\nPlease try again.","Logon Credentials error!",MessageBoxButtons.OK,MessageBoxIcon.Stop);}
This is that last version that I tried, I will try and find some of the other code that I have used. If and when I find it I will add it to this forum.
Thanks again in advance
Scott
ryoma
Hi Scott
Be specific, what exactly have you tried and what errors are you getting when you try something. This will make it easier for me and other Developers to help you.
Thanks
AVSYNaidu
Hi scott
this is more like it, by looking at this code it seems everything is in track, thats cool.
Peter607
Hi everyone,
I used the code above (making the ammends as needed), but to no luck. I have now tried to use the data from my DB and just put it into a standard datagrid view, guess what....
....No data found. What is going on here. I think I may have to give up on this and use SQL. So now my next question is, if I was to use SQL would I have to ship a version on SQL Server with my application (please note that my application will be sent via CD and I want people who dont have high speed internet to have everything avalible from the CD).
...Or do I just start again with the whole Access thing and see if I made a mistake in the whole data structure and the databinding process.
Any ideas or thoughts greatly recieved.
Thanks
Scott