SQL Database Access

  • Thread starter Thread starter Greg Smith
  • Start date Start date
G

Greg Smith

Can someone post some sample code on how to access a sql
database and put the data into a listbox??

Thanks
 
The database that I am connecting to is called caller.
The fields that I need are called caller_firstname and
caller_lastname.

server name: sqltest001

DSN name is call esp_ms_sql
UID name is test
Password is user
 
Can someone post some sample code on how to access a sql
database and put the data into a listbox??
You are starting at the wrong end. First, write the stored procedure,
in the SQL database, that will move the necessary parameters into the
database fields. This will define what has to be in the calling
parameters.

Hollis D. Paul [MVP - Outlook]
(e-mail address removed)
Using Virtual Access 4.52 build 277 (32-bit), Windows 2000 build 2195
http://search.support.microsoft.com/kb/c.asp?FR=0&SD=TECH&LN=EN-US

Mukilteo, WA USA
 
Huh ...

Here is my code so far:

Sub cmdTest_Click()

SQLProvider = "DSN=esp_ms_sql;UID=test;PWD=user"
Set SQLConn = Server.CreateObject("ADODB.Connection")
SQLConn.Open SQLProvider
' SQLConn.CommandTimeOut=90 (optional)
strQry = "Select * FROM caller WHERE caller_firstname"
Set objRS1 = SQLConn.Execute(strQry)
msgbox "done"

End Sub
 
Back
Top