|
-
May 22nd, 2000, 07:18 PM
#2
Addicted Member
Well, this is what you need:
I guess you by now know how to retrieve data from access from a VB form correct? if yes then
1.You must learn how to create an ActiveX component from VB
2.How to call the component from ASP
Here is an example:
for example you could have this function in a class module:
Public Function GetData(name as string) as ADODB.Recordset
'Get a connection to your database here
'Set a recordset object
'Execute a SQL query
cnn.Open "DSN=MyDatabase"
Set rs=new ADODB.Recordset
set rs=cnn.Execute "Select * from table"
'Return the recordset
set GetData=rs
End Function
Make a dll. Now your COM components is known as the project name + the class name for example: MyFirstCOM.clsData
MyFirstCOM is the name of the project and clsData is the name of the class.
Now it's ASP time:
<%
set obj=Server.CreateObject("MyFirstCOM.clsData")
set rs=Server.CreateObject("ADODB.Recordset")
set rs=obj.GetData("André")
if not rs.eof then
response.write rs.Fields("LastName")
end if
set rs=nothing
set obj=nothing
%>
Of course you need to apply your database etc.
I hope it helps a little
cheers
André
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|