Connection Strings in web.config?


Question: I have an web application that I made and put up on a webserver. It pulls data from an access database that I use as a demo database. I am trying to get my connection string set up right to work with my database since it is now on the host server and not my computer. I have my access databse loaded up on my host webserver and and the host company has a page that test the connection to the databse and it tells me the connection string and then displays all the tables in the access database. So it is working proberly. The connection string they game me is below
set testconn=server.createobject("...
Set TestRs = Server.CreateObject ("ADODB.RecordSet")
cnstr = "DSN=DGFMed.demo"
testconn.Open cnstr

I dont know what my connection string should look like. What I have now is below and is not working

<add name="DemoConnectionString" connectionString="DNS=DGFmed.d...
providerName="System.Data.OleD... />

what do I need to change?

Answer:
You should not be using a DSN on your host unless they have set one up for you (not recommended - DSNs are more frustrating than useful).

The following connection string should work for most situations:

"Provider = Microsoft.Jet.OLEDB.4.0; Data Source=database.mdb; User Id=usr; Password=pwd"

The example below is not correct for connecting to a file-based Access data source.
It should be

<appSettings>
<add key="myConnString" value="Data Source = serverName; Initial Catalog = database name; Integrated security=SSPI; username= user; password = pwd />
</appSettings>

Remember Integrated security SSPI is windows authentication, if its not windows auth, you need to set it to false and just pass in the username and password for the SQL database.

Also google web.config, plenty of good articles especially on 4guysfromRolla

http://aspnet.4guysfromrolla.com/article...
More Questions & Answers...
  • I am having severe dsl slow down. what could it be from?
  • Where can i find some good books and stuff on software testing tips and tricks?
  • Customizing a Flash Template?
  • Wild Blue Satellite down load speeds?
  • What is capacity planning and load testing?
  • The Collapse of the Twin Towers Part V: Can the Conspiracy Theorists debunk this?
  • ASPX Frameworks 2.0 "Parser Error" WHY?
  • Can you help me with these questions?
  • The questions and answers post by the user, for information only, AnswersRoom.com does not guarantee the right
    Copyright © 2007 AnswersRoom.com -   Terms of Use -   Contact us

    Hot Topic