RE: Q: using DSN

Tech-Archive recommends: Speed Up your PC by fixing your registry



Hi Dear JIM.H,

This is the sample where you give all your connection string values inside
the asp.net file (ie. for example: in code behind)

But in your case You have to give

either

"DSN=mySystemDSN;" & _
"Uid=myUsername;" & _
"Pwd=myPassword"

or

"FILEDSN=c:\somepath\mydb.dsn;" & _
"Uid=myUsername;" & _
"Pwd=myPassword"

in you web.config in <appSettings></appSettings> section like below

<configuration>
<appSettings>
<add key="pubsDSN" value="DSN=mySystemDSN;Uid=myUsername;Pwd=myPassword"
/>
</appSettings>
</configuration>

OR

<configuration>
<appSettings>
<add key="pubsFileDSN"
value="FILEDSN=c:\somepath\mydb.dsn;Uid=myUsername;Pwd=myPassword"/>
</appSettings>
</configuration>

and

in your code behind to access the web.config file DSN/FileDSN

Dim dsn As String = ConfigurationSettings.AppSettings("pubsDSN")
or
Dim dsn As String = ConfigurationSettings.AppSettings("pubsFileDSN")


ODBC DSN
=======
Using an ODBC DSN (Data Source Name) is a two step process.

1) You must first create the DSN via the "ODBC Data Source Administrator"
program found in your computer's Control Panel (or Administrative Tools menu
in Windows 2000). Make sure to create a SYSTEM DSN (not a USER DSN) when
using ASP(I think same thing holds good for ASP.NET).

2) Then use the following connection string - with your own DSN
name of course.

DSN
====
oConn.Open "DSN=mySystemDSN;" & _
"Uid=myUsername;" & _
"Pwd=myPassword"

File DSN
======
oConn.Open "FILEDSN=c:\somepath\mydb.dsn;" & _
"Uid=myUsername;" & _
"Pwd=myPassword"

Note:
====
The problem with DSN is that Users can (and will) modify or delete them by
mistake, then your program won't work so well. So it's better to use a
DSN-Less or OLE DB Provider connection string - with a Trusted Connection if
possible!



About ODBC data sources
================
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/off2000/html/acconAboutODBCDataSources.asp


Login System (ASP.NET)
================
http://www.codeproject.com/Purgatory/Login_System.asp

For Anything & Everything, Please Let Me Know

Bye
Venkat_KL
.



Relevant Pages

  • Re: Pass through / ODBC Data Source
    ... ODBC Data Source Names can be user-specific, ... I have multiple users "sharing" a single DSN. ... I have a linked table in my shop database to ...
    (microsoft.public.access.queries)
  • Re: how to retrieve mailmerge field name using vb.net
    ... When it connects to an ODBC data source, ... anything in the existing DSN can be overridden by an item in the ... COnnection string, /except/ the driver name. ... If there is a header Source, the user should be able to select from the list ...
    (microsoft.public.word.mailmerge.fields)
  • Re: how to retrieve mailmerge field name using vb.net
    ... When it connects to an ODBC data source, ... anything in the existing DSN can be overridden by an item in the ... COnnection string, /except/ the driver name. ... If there is a header Source, the user should be able to select from the list ...
    (microsoft.public.word.mailmerge.fields)
  • Re: Create DSN Programmatically
    ... Referring to the connection string as a Data ... > Source Name (DSN) is a naming convention used to refer to the connection ... Only in the case of ODBC API ...
    (microsoft.public.vsnet.general)
  • Re: How do I add option ZERO_DATE_TO_MIN in mysql connector?
    ... > For 1, it seems that you can set the value in the "Option" textbox in> GUI, if you are using Windows platform. ... I guess this will override any options set by the checkboxes in the DSN construction dialog so it might be dangerous. ... May be you know a way to get the DSN-less connection string from a DSN? ... ODBC DM will then prompt a dialog to allow users to select a DSN at runtime. ...
    (microsoft.public.data.odbc)