Discussion Locked

data base connection in COM+ componenr

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
Why I Can't connect to my data base in my COM+ application. My COM+ application give good reponse while it was accessed but not its connection to database

2 replies

by chris.wolfe

It's not possible to give a definitive answer to the question you've posed as there are no details; however, the follow code snippit (in VB) will return a recordset from a query to the Authors table in the SQL Server Pubs database. If your COM+ component were to return a ADODB.Recordset object, you could iterate through the Recordset in the client and check the results.
--------------------------------------
dim strSQL
dim strConnectString
dim cnPubs
dim rstAuthors

set cnPubs = Server.CreateObject("ADODB.Connection")

strConnectString = "DRIVER={SQL Server};"
strConnectString = strConnectString & "SERVER=(local);DATABASE=pubs;UID=sa;PWD=;"

strSQL = "SELECT au_lname, au_fname FROM AUTHORS"

cnPubs.Open strConnectString

set rstAuthors = Server.CreateObject("ADODB.Recordset")
rstAuthors.Open strSQL, cnPubs, 3, 1
if not (rstAuthors.BOF and rstAuthors.EOF) then
rstAuthors.MoveLast
rstAuthors.MoveFirst
end if
--------------------------------------
Regards,Chris Wolfe
Idea In

This discussion is closed to new replies.