Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Posted

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;"

Posted
  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

Posted

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?

Posted

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;";

Posted

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

Posted

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";

Posted (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 by kejpa
Posted
  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

Posted
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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...