Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Dear Experts I am trying to execute some very simple sql from vba. The sql is USE master; SELECT NAME FROM sysdatabases I want to then place the results in a list box on a vba form To do this I am looking at recordsets and ado where I cannot find a decent documented method i can work with. So far I have created soucon = "Provider=" & Master.TextBox22.Value & ";Data Source=" & Master.TextBox23.Value _ & ";Initial Catalog=" & Master.TextBox24.Value & ";User id=" & Master.TextBox25.Value _ & ";Password=" & Master.TextBox26.Value Set ConSource = CreateObject("ADODB.Connection") ConSource.Open soucon which i believe works and connects to Master - how do i now create a recordset and populate my list box is my question ? If you respond thank you for your time and efforts as always kind regards -- C Ward |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
dim rs as ADODB.recordset
dim sql as string sql = "USE master; SELECT NAME FROM sysdatabases" set rs = consource.execute(sql,,1) do while not rs.eof 'rs(0) will be the current NAME, do whatever you want with it rs.movenext loop "christopher ward" wrote: Dear Experts I am trying to execute some very simple sql from vba. The sql is USE master; SELECT NAME FROM sysdatabases I want to then place the results in a list box on a vba form To do this I am looking at recordsets and ado where I cannot find a decent documented method i can work with. So far I have created soucon = "Provider=" & Master.TextBox22.Value & ";Data Source=" & Master.TextBox23.Value _ & ";Initial Catalog=" & Master.TextBox24.Value & ";User id=" & Master.TextBox25.Value _ & ";Password=" & Master.TextBox26.Value Set ConSource = CreateObject("ADODB.Connection") ConSource.Open soucon which i believe works and connects to Master - how do i now create a recordset and populate my list box is my question ? If you respond thank you for your time and efforts as always kind regards -- C Ward |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Question for MVP - install Excel 2003 on MS Server 2003 | Setting up and Configuration of Excel | |||
Excel 2007 - Sharpoint 2003 can't update list on server | Excel Discussion (Misc queries) | |||
Excel 2003 Error Cannot Locate the Internet Server or Proxy Server | Excel Discussion (Misc queries) | |||
Excel 2003 Database Driver Visual FoxPro 7 on Server 2003. | Excel Discussion (Misc queries) | |||
Excel 2003 .net, sql server | Excel Programming |