Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
database connection question
how to connect to and get data from sql server express 2008 using VBA?
Thanks Charles |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
database connection question
Refer the below link
http://www.ozgrid.com/forum/showthread.php?t=83016 If this post helps click Yes --------------- Jacob Skaria "Charles Law" wrote: how to connect to and get data from sql server express 2008 using VBA? Thanks Charles |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
database connection question
this will get you started. Open the dev environment (ALT+F11) then set a
reference (Tools / References) to the Microsoft Active Data Objects 2.6 Library paste this into a new sub: SUB Demo() Dim rst As ADODB.Recordset Dim db As Connection Dim SQL As String Set db = New Connection With db .CursorLocation = adUseClient .Open "PROVIDER=MSDASQL;driver={SQL Server};server=Patrick-PC;uid=;pwd=;database=MyDatabase;" End With Set rst = New Recordset SQL = "select * from products" rst.Open SQL, db, adOpenStatic, adLockOptimistic range("A1").CopyFromRecordset rst rst.Close db.Close set rst = Nothing set db = Nothing End Sub "Charles Law" wrote in message ... how to connect to and get data from sql server express 2008 using VBA? Thanks Charles |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
database connection dsn vs. odc | Excel Programming | |||
Database Connection | Excel Programming | |||
Database Connection | Excel Programming | |||
Database Connection | Excel Programming | |||
DataBase Connection | Excel Programming |