943,742 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 519
  • C# RSS
Sep 18th, 2009
0

connection to database

Expand Post »
HI ME AGAIN=|

I'm basically new to connecting to database.

MY PROBLEM is that i do not know how to connected to database[ microsoft access]

eg. the password entered, is stored at microsoft access database. how do i connect the window application to database so that when i run the window application the password enter and saved is store into the database. and we can refer to database to see if they have type the wrong password.

I'm kinda stuck here that i can't proceed with my projext so i desperately need some advice=| thankss=))
Similar Threads
Reputation Points: 1
Solved Threads: 0
Junior Poster in Training
facadie is offline Offline
57 posts
since Sep 2009
Sep 18th, 2009
0

Re: connection to database

I have posted a sample application using an SQL Connection, but you change the SqlConnection to OleDbConnection, SqlCommand to OleDbCommand, etc.
http://www.daniweb.com/code/snippet217409.html

For generating the access connection string:
C# Syntax (Toggle Plain Text)
  1. public static string BuildAccessConnectionString(string Filename, string Username, string Password, string DatabasePassword)
  2. {
  3. return string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source='{0}';User Id={1};Password={2};Jet OLEDB:Database Password={3};",
  4. Filename.Replace("'", "''"),
  5. Username,
  6. Password,
  7. DatabasePassword);
  8. }
  9. public static string BuildAccess2007ConnectionString(string Filename, string DatabasePassword)
  10. {
  11. return string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='{0}';Persist Security Info=False;Jet OLEDB:Database Password={1};",
  12. Filename.Replace("'", "''"),
  13. DatabasePassword);
  14. }
Featured Poster
Reputation Points: 1749
Solved Threads: 735
Senior Poster
sknake is offline Offline
3,948 posts
since Feb 2009
Sep 18th, 2009
0

Re: connection to database

You can always use www.connectionstrings.com =)
Featured Poster
Reputation Points: 480
Solved Threads: 276
Postaholic
Ramy Mahrous is offline Offline
2,189 posts
since Aug 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: Validation of Textbox C# window application
Next Thread in C# Forum Timeline: How to change folder or file name using C# ?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC