Last post Jul 21, 2009 07:14 AM by mohdazeemuddin
Jul 19, 2009 03:55 AM|mohdazeemuddin|LINK
Hi Every body,
i write the connection stirng for Ms Access 2003 database but its not opening my database i don't know why.the connection string is
OleDbConnection oledb=new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Sources=C:\\Documents and Settings\\Administrator\\My Documents\\Intranet.mdb");
and the command string is
OleDbCommand oledbcmd=new OleDbCommand(str,oledb);
and str = "select UserName,Password from UsreDetail where UserName='" + UserName + "' and Password='" + Password + "'";
please help me what will be the exact connection string
thanks in advance
Jul 19, 2009 07:24 AM|Abdulla.AbdelHaq|LINK
build your connection string from the below site
send to us the actual error.
Jul 20, 2009 02:12 AM|mohdazeemuddin|LINK
I try all the possible way from that website before but i am not able to connect to database.
Jul 20, 2009 06:45 AM|hans_v|LINK
What makes you think there's something wrong with your connectionstring? Where do you get the error, when you try to open the connection (meaning your connectionstring is OK) or when you try to execute the SQL statement? In the last case, the reason is
simple. You're using a
reserved word (Password) as a fieldname, if you do, enclose it in brackets like
SELECT [password] .....
I would strongly advice you to uses
Parameterized queries, if you want to build a simple login system take a look
here, and maybe use the build in membership providers with Access using
this tutorial instead.
By the way, what error do you get? When you want to write to the database, make sure you set the
right permissions and maybe you need to change the
location of you file If you still have errors, maybe
this will help
Jul 20, 2009 12:11 PM|Mikesdotnetting|LINK
"Provider=Microsoft.Jet.OLEDB.4.0;Data Sources=C:\\Documents and Settings\\Administrator\\My Documents\\Intranet.mdb"
It's "Data Source", not "Data Sources".
There's just one of them.
Jul 21, 2009 07:14 AM|mohdazeemuddin|LINK
Thanks to all for your support