Set oDbCon=createobject("ADODB.connection")
oDbCon.open="Provider=SQLOLEDB;Data Source=computerName; Trusted_Connection=Yes;Initial Catalog=database_name;User ID=username;Password=password;"
set oData=oDbCon.execute("select * from table_name")
oFields=oData.fields.count
For oFld=0 to oFields-1
fldName=oData.fields(oFld).name
oval=""
While not oData.eof
oval=oval&oData(fldName)&vbnewline
oData.movenext
Wend
msgbox oval,vbokonly,fldName
oData.movefirst
Next
oDbCon.open="Provider=SQLOLEDB;Data Source=computerName; Trusted_Connection=Yes;Initial Catalog=database_name;User ID=username;Password=password;"
set oData=oDbCon.execute("select * from table_name")
oFields=oData.fields.count
For oFld=0 to oFields-1
fldName=oData.fields(oFld).name
oval=""
While not oData.eof
oval=oval&oData(fldName)&vbnewline
oData.movenext
Wend
msgbox oval,vbokonly,fldName
oData.movefirst
Next