connection to database

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Sep 2009
Posts: 54
Reputation: facadie has a little shameless behaviour in the past 
Solved Threads: 0
facadie facadie is offline Offline
Junior Poster in Training

connection to database

 
0
  #1
Sep 18th, 2009
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=))
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 3,187
Reputation: sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of 
Solved Threads: 571
Sponsor
sknake's Avatar
sknake sknake is offline Offline
.NET Enthusiast

Re: connection to database

 
0
  #2
Sep 18th, 2009
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:
  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. }
Scott Knake
Custom Software Development
Apex Software, Inc.
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: connection to database

 
0
  #3
Sep 18th, 2009
You can always use www.connectionstrings.com =)
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC