ADO.net Connection String


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: ADO.net Connection String

  1. #1
    Martin Guest

    ADO.net Connection String


    have a login form in which I want to enter the UserID and Password and then
    pass it as a parameter for ADODB connection string.

    here is the code:

    Dim cn As New ADODB.Connection()
    cn.ConnectionString = "provider=sqloledb;server=66.134.31.35;database=northwind;uid=sa"
    cn.Open()


  2. #2
    Jim Ferguson Guest

    Re: ADO.net Connection String

    I'm not sure what the question is here? Typically you can store the
    value (best if encrypted) in your app.config file, and then use the
    built-in Configuration object to retrieve the value:

    In your app.config file:

    <appSettings>
    <add key="connectionstring" value = "Data Source=servername;user
    id=sa;password=xxx;Initial Catalog=tttt"/>
    </appSettings>

    To retrieve value, import system.configuration, and use code like:

    dim conString as string =
    ConfigurationSettings.AppSettings("ConnectionString")

    -- Jim F.


    >have a login form in which I want to enter the UserID and Password and then
    >pass it as a parameter for ADODB connection string.
    >
    >here is the code:
    >
    > Dim cn As New ADODB.Connection()
    > cn.ConnectionString = "provider=sqloledb;server=66.134.31.35;database=northwind;uid=sa"
    > cn.Open()


    -- Jim F.
    http://www.fmsinc.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center