Home > Ask the SQL Server Experts > Archive: Business Intelligence Questions & Answers > Connecting to SQL Server using Visual Studio
Ask The SQL Server Expert: Questions & Answers
EMAIL THIS

Connecting to SQL Server using Visual Studio

Eric Brown EXPERT RESPONSE FROM: Eric Brown

Pose a Question
Other SQL Server Categories
Meet all SQL Server Experts
Become an Expert for this site


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


>
QUESTION POSED ON: 30 January 2006
How can I connect to SQL Server?


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
SQL Server Database Modeling and Design
Optimizing SQL Server indexes –- even when they're not your indexes
Top tips and tricks for SQL Server database development
Managing the development lifecycle with Visual Studio Team System 2008
A first look at Visual Studio Team System 2008 Database Edition
Testing transaction log autogrowth behavior in SQL Server
Top 10 SQL Server Tips of 2008
Tutorial: SQL Server indexing tips to improve performance
Tutorial: Learn SQL Server basics from A-Z
SQL Server database design disasters: How it all starts
Can you shrink your SQL Server database to death?

Archive: Business Intelligence
Troubleshoot Web service issues in SQL Server 2005 Reporting Services
Ordering the results of a SQL query
Using MDX and UDM in a SQL Server Analysis Services environment
SSIS error message due to installation problem on SQL Server 2005
Configuring SQL Server with a changed computer name
Resources for business intelligence and data mining in SQL Server 2005
Problems exporting to Excel
The pros and cons of data warehousing
Visual Studio report processing error
Problems running SQL Server 2000 RTM without service pack

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
binary tree  (SearchSQLServer.com)
block  (SearchSQLServer.com)
data structure  (SearchSQLServer.com)
DDBMS  (SearchSQLServer.com)
entity-relationship model  (SearchSQLServer.com)
initial extent  (SearchSQLServer.com)
primary key  (SearchSQLServer.com)
segment  (SearchSQLServer.com)
tablespace  (SearchSQLServer.com)
view  (SearchSQLServer.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


You would think this would be easy to answer, but there are multiple ways to connect to SQL Server. Depending on which version of Visual Studio you're using, with different levels of complexity, Visual Studio 2003 and 2005 have made using SQL Server data much more straight forward.

Basically, there are two parts to connecting and working with SQL Server. The connection looks something like:

Dim yourdbCnn As ADODB.Connection
Set yourdbCnn = New ADODB.Connection

Dim strdbCnn As String
strdbCnn = "Provider=SQLOLEDB;Driver={SQL Server};"
strdbCnn = strCnn & "Server=YourSQLServerName;"
strdbCnn = strCnn & "Database=YourdatabaseName;"
strdbCnn = strCnn & "uid=YourUser;pswd=YourPassword;"

yourdbCnn.ConnectionString = strCnn

For additional help, check out the Microsoft center for data access technologies and this SQL Server Express resource.




Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice



SQL Solutions - SQL Database Design
HomeNewsTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersIT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2005 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts