Hi can someone give me an example of how to connect to an Access 2000 database using asp.net with a dsn.
Thanks
Alex
Printable View
Hi can someone give me an example of how to connect to an Access 2000 database using asp.net with a dsn.
Thanks
Alex
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.
So you cant just put dsn=myDsn in the connection string like good old asp?
Alex
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.
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