ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to connect MS SQL Server using VBA Macro Programming? (https://www.excelbanter.com/excel-programming/400073-how-connect-ms-sql-server-using-vba-macro-programming.html)

Raju A

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

SeanC UK[_3_]

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


Raju A

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



All times are GMT +1. The time now is 06:52 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com