Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 56049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T17:28:25+00:00 2026-05-10T17:28:25+00:00

I need a programmatic way of creating a SQL Server ODBC Data Source. I

  • 0

I need a programmatic way of creating a SQL Server ODBC Data Source. I can do this by directly accessing the Registry. It would be better if this could be done via an available (SQL Server/Windows) API to protect against changes in the registry keys or values with updated SQL Server drivers.

Accepted Answer Note: Using SQLConfigDataSource abstracts the code from the details of Registry keys etc. so this is more robust. I was hoping, however, that SQL Server would have wrapped this with a higher level function which took strongly typed attributes (rather than a delimited string) and exposed it through the driver.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T17:28:25+00:00Added an answer on May 10, 2026 at 5:28 pm

    SQLConfigDataSource() does the job.

    MSDN article

    Just in case here is a VB6 example:

    Const ODBC_ADD_DSN = 1 'user data source Const ODBC_ADD_SYS_DSN = 4 'system data source  Private Declare Function SQLConfigDataSource Lib 'ODBCCP32.DLL' (ByVal hwndParent As Long, ByVal fRequest As Long, ByVal lpszDriver As String, ByVal lpszAttributes As String) As Long  strDriver = 'SQL Server' strAttributes = 'DSN=Sample' & Chr$(0) _ & 'Database=Northwind' & Chr$(0) _ & 'Description= Sample Data Source' & Chr$(0) _ & 'Server=(local)' & Chr$(0) _ & 'Trusted_Connection=No' & Chr$(0)  SQLConfigDataSource(0, ODBC_ADD_SYS_DSN, strDriver, strAttributes) 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 86k
  • Answers 86k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Set the showsHorizontalScrollIndicator and showsVerticalScrollIndicator properties of the UIScrollView to… May 11, 2026 at 5:25 pm
  • Editorial Team
    Editorial Team added an answer Just say "This package includes software with the following licenses:"… May 11, 2026 at 5:25 pm
  • Editorial Team
    Editorial Team added an answer No there is not. Automatic properties do little more than… May 11, 2026 at 5:25 pm

Related Questions

For a Website I'm developing, I will need to create some graphics. I haven't
I need to be able to remove a specific certificate from each PC in
I've been tasked with the the maintenance of a nonprofit website that recently fell
Due to repetitive errors with one of our Java applications: Engine engine_0: Error in

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.