Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How to connect MS SQL Server using VBA Macro Programming?

Hi,

Can you pls send me the connection string of connecting MS SQL Server using
VBA Programming...

Reply me asap..

Regards
Raj
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default How to connect MS SQL Server using VBA Macro Programming?

Hi Raj,

The exact details will depend on the server name, user name and password etc.

Here is a way to get most of the information you need.

Open Windows Explorer and in some directory right click and choose
NewText Document.

Then change the file extension of that document from .txt to .udl This
changes the file type to a data link file.

Double click the file and the Data Link properties dialogue will appear.
Select the required Provider on the first tab and click Next. Fill in the
required information on the Connection tab (Server, User Name etc). Test the
connection to make sure you have the details correct. Once you have then
click OK.

The above step requires the oledb32.dll (or similar) to be on your system,
and it should be by default.

Now right click the file and select Open With and choose Notepad. Now you
will see the udl file in notepad, and that will have your specific connection
string. Once you have the basics of this in your code you can play around
with it so that you can ask the user for their User Name and Password etc.

Hope this helps,

Sean.
--
(please remember to click yes if replies you receive are helpful to you)


"Raju A" wrote:

Hi,

Can you pls send me the connection string of connecting MS SQL Server using
VBA Programming...

Reply me asap..

Regards
Raj

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How to connect MS SQL Server using VBA Macro Programming?

hi sean,

Thanks a lot for ur immediate reply.

can i have ur mail id.
mine is

Raj

"SeanC UK" wrote:

Hi Raj,

The exact details will depend on the server name, user name and password etc.

Here is a way to get most of the information you need.

Open Windows Explorer and in some directory right click and choose
NewText Document.

Then change the file extension of that document from .txt to .udl This
changes the file type to a data link file.

Double click the file and the Data Link properties dialogue will appear.
Select the required Provider on the first tab and click Next. Fill in the
required information on the Connection tab (Server, User Name etc). Test the
connection to make sure you have the details correct. Once you have then
click OK.

The above step requires the oledb32.dll (or similar) to be on your system,
and it should be by default.

Now right click the file and select Open With and choose Notepad. Now you
will see the udl file in notepad, and that will have your specific connection
string. Once you have the basics of this in your code you can play around
with it so that you can ask the user for their User Name and Password etc.

Hope this helps,

Sean.
--
(please remember to click yes if replies you receive are helpful to you)


"Raju A" wrote:

Hi,

Can you pls send me the connection string of connecting MS SQL Server using
VBA Programming...

Reply me asap..

Regards
Raj

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Connect to OPC / DDE server Critcho Excel Worksheet Functions 0 December 6th 07 02:18 AM
How can I use VBA to connect to a SQL server? Bed Guy Excel Programming 1 May 29th 07 10:25 PM
what if the configured proxy server does not connect pandrobineaux Excel Programming 0 January 4th 06 04:01 PM
connect to an oracle server Bill Li Excel Programming 0 August 14th 03 04:31 AM


All times are GMT +1. The time now is 09:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"