Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!
  1. Guest ji, please consider donating today!   Become a Supporter    ::   Make a Contribution   
    Monthly (Recurring) Target: $300 :: Achieved: $95

vba sql server connection

Discussion in 'Information Technology' started by zuEgg, Jul 28, 2006.

  1. zuEgg

    zuEgg
    Expand Collapse
    Guest

    Hi,

    i need to connect to a SQL Server db using an odbc data source and SQL
    Server authentication. When i create the data source from the control
    panel i set up the authentication with the SQL Server authentication
    providing my id and pass.

    The problems comes when i open the connection in the vba macro in
    excel. it doesn't retrieve the informations about user and pass from
    the data source and i don't want to put user and pass in the macro code
    for security reasons...

    The code of the connection setup:

    cn.Open "PROVIDER=MSDASQL; DSN=data_source_name; DATABASE=db_name;
    UID=; PWD=;"<---- these parameters are needed even if i've put them in
    the data source definition.

    Thanks for any hint!

    Massimo
     
  2. Loading...

    Similar Threads Forum Date
    Microsoft Brings 64-Bit Perks in SQL Server 2000 Service Pack (Ziff Davis) Interfaith Dialogues May 7, 2005

  3. Norman Yuan

    Norman Yuan
    Expand Collapse
    Guest

    If you have enterd username/password when creating the DSN, you do not need
    to supply them again in your VBA code's ConnectionString, the only thing you
    need in your ConnectionString is the DSN:

    cn.Open "MyDSN"

    As long as the DSN is valid to current user (Systam DSN or an User DSN that
    is for current user).

    BTW, this NG is for MS Access. You may get better response from other
    appropriate NGs.

    "zuEgg" <zuegg@hotmail.it> wrote in message
    news:1152629941.074431.202460@35g2000cwc.googlegroups.com...
    > Hi,
    >
    > i need to connect to a SQL Server db using an odbc data source and SQL
    > Server authentication. When i create the data source from the control
    > panel i set up the authentication with the SQL Server authentication
    > providing my id and pass.
    >
    > The problems comes when i open the connection in the vba macro in
    > excel. it doesn't retrieve the informations about user and pass from
    > the data source and i don't want to put user and pass in the macro code
    > for security reasons...
    >
    > The code of the connection setup:
    >
    > cn.Open "PROVIDER=MSDASQL; DSN=data_source_name; DATABASE=db_name;
    > UID=; PWD=;"<---- these parameters are needed even if i've put them in
    > the data source definition.
    >
    > Thanks for any hint!
    >
    > Massimo
    >
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page