SQL Database Access

G

Greg Smith

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

Thanks
 
G

Greg Smith

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
 
H

Hollis D. Paul

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
 
G

Greg Smith

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top