PDA

Click to See Complete Forum and Search --> : asp.net dsn connections


alexmac
Mar 24th, 2002, 12:38 PM
Hi can someone give me an example of how to connect to an Access 2000 database using asp.net with a dsn.

Thanks

Alex

Shawn N
Mar 27th, 2002, 07:14 PM
Put this at the top of your Web.Config file inside the "Configurations" node.

<!-- SETTINGS
Section containts global constants for application.
-->
<appSettings>
<add key="DSN" value="Initial Catalog=DBName;Data Source=localhost;Integrated Security=SSPI;uid=IUSR_GUEST" />
</appSettings>

Then this bit of coding

Dim dsn As String = ConfigurationSettings.AppSettings("dsn")

will return the value in Web.Config.

alexmac
Apr 1st, 2002, 09:53 AM
So you cant just put dsn=myDsn in the connection string like good old asp?

Alex

Cander
Apr 1st, 2002, 10:03 AM
you can still do that also. I think that using it the way shown is better becuase if you need to make changes it is always better to do so in one place in case you need to use it in multiple pages.

alexmac
Apr 1st, 2002, 10:06 AM
Thanks Cander can you post an exampe of using both ways? I get some weird message about could not find provider if I try to do it the way I would in old asp.

Thanks,

Alex

Shawn N
Apr 4th, 2002, 11:11 AM
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q209805