Flovit Posted September 21, 2004 Posted September 21, 2004 I have problems with Syntax of a full Connection String (Asp.Net / C# ) here is the Connection String with problems this.dbCon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" &_ "Data Source=Server.MapPath("~/database/dbx.mdb")" &_ Jet OLEDB:System Database =Sec.mdw;" &_ User ID =aName ; Password= 123x ; Could you help me please Quote
bri189a Posted September 21, 2004 Posted September 21, 2004 Try the below...think it should be 'Database Password' not 'Password'...might be remembering something else so try both. this.dbCon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + Server.MapPath("~/database/dbx.mdb") + " Jet OLEDB:System Database =Sec.mdw;" + User ID=aName; Database Password=123x;" Quote
kejpa Posted September 21, 2004 Posted September 21, 2004 Quote this.dbCon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" &_ "Data Source=Server.MapPath("~/database/dbx.mdb")" &_ Jet OLEDB:System Database =Sec.mdw;" &_ User ID =aName ; Password= 123x ; Using my VB glasses I see some missing and misplaces " I'd have it this way this.dbCon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" &_ Data Source=Server.MapPath("~/database/dbx.mdb") &_ "Jet OLEDB:System Database =Sec.mdw;" &_ "User ID =aName ; Password= 123x ;"; But I've never done any c#.... HTH /Kejpa Quote
Flovit Posted September 21, 2004 Author Posted September 21, 2004 I Test both your Con Strings exactly but the code doen't accept them . Now ? Quote
bri189a Posted September 21, 2004 Posted September 21, 2004 Okay, let's back up a second... what do you mean 'the code doesn't accept them'... you get a compile error? You get the red squiggly lines underneath that signifies bad syntax? You get a runtime error? VB'ers - Isn't 'this' a C# keyword and the equivelant in VB still 'Me' so thus his code above is in C# and therefore being using the '+' string concatention instead of the '&' string concatenation which is VB syntax? Quote
Flovit Posted September 21, 2004 Author Posted September 21, 2004 I know I have mistakes about using characters maybe an additional ";" my problem is only about the string breaking with special characters , thanks alot Quote
bri189a Posted September 21, 2004 Posted September 21, 2004 Here's how you would use special charactars. let's say we want our datasource in between quotes with line breaks - hope it helps: this.dbCon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=\"" + Server.MapPath("~/database/dbx.mdb") + "\";" + "Jet OLEDB:System Database =Sec.mdw;" + User ID=aName; Database Password=123x;"; Quote
Flovit Posted September 22, 2004 Author Posted September 22, 2004 Thank you , Im going to try it, I think that I get my answer Quote
Flovit Posted September 22, 2004 Author Posted September 22, 2004 Another Problem Apeared I use this connectionString this.dbCon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + Server.MapPath("~/database/db.mdb") + ";" + "Jet OLEDB:System Database =Sec.mdw;" + "User ID =aName ; Password= 123x ;Database Password = 456x " ; before adding --> Database Password = 456x this application works correctly but after adding this part I get this error : "Could not find installable ISAM" why ? please help me Quote
bri189a Posted September 22, 2004 Posted September 22, 2004 You to have Database Password, not Password, this is how you should have it to be absolutely complete: this.dbConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "User ID=Admin;Data Source=" + Server.MapPath("~/database/db.mdb") + ";" + "Mode=Share Deny None;Extended Properties=\"\";" + "Jet OLEDB:System database=\"\";Jet OLEDB:Registry Path=\"\";" + "Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=1;" + "Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;" + "Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;" + "Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Database Password=asdf" + "Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False"; Quote
kejpa Posted September 23, 2004 Posted September 23, 2004 (edited) I would suggest this little nifty trick... Make a new text file on your desktop. Rename it to "WhatEverYouLike.udl" Double click it and you will get a wizard helping you to connect to your database. Once the connection is tested and functional open the udl-file in notepad and voilá there's your connection string. Copy and paste into your module and make the necessary changes for database location and such... HTH /Kejpa Edited September 23, 2004 by kejpa Quote
Flovit Posted September 23, 2004 Author Posted September 23, 2004 Thank you So you think that using both of password & Database Password cause this problem ? ok for now , Im going to test it Quote
kejpa Posted September 23, 2004 Posted September 23, 2004 Quote So you think that using both of password & Database Password cause this problem ? Access databases can be protected by a database password, aswell as with a user/password defined in a system.mdw There are two different parameters in the connectionstring for the user password and the database password. I still think it's the best to make use of the udl-wizard if you're experiencing troubles with connecting. HTH /Kejpa Quote
bri189a Posted September 23, 2004 Posted September 23, 2004 Ditto what Kejpa said. More than likely your just using the database password. Most people don't understand the differance, or that there is one and come to find out that they're using the database password. Using the wizard is a sure-fire way to get your connection string right...after you do it a few hundred times it won't be a problem, but myself and probably a lot people on this site have resorted to using the wizard to from a connection string correctly when we couldn't get it right from memory. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.