|
-
Jun 5th, 2000, 04:11 PM
#1
Thread Starter
Addicted Member
Hi,
I am trying to create a VB class component to connect to SQL Server. The class uses a defined connection_string property which expects a string ( a DSN ), and makes a database connection as a result. However when I create the object in VBScript and try to set the connection_string property it fails with:
Error Type:
Microsoft VBScript runtime (0x800A01C2)
Wrong number of arguments or invalid property assignment: 'connection_string'
/tony/query_detail.asp, line 16
VB Code:
------------------------------------------------------------
Public Sub Make_Connection()
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
'
' Implement the DSN
'
conn.Open Connection_String
End Sub
------------------------------------------------------------
Public Property Let Connection_String(ByVal vData As String)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.Connection_String = 5
mvarConnection_String = vData
End Property
------------------------------------------------------------
Public Property Get Connection_String() As String
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.Connection_String
Connection_String = mvarConnection_String
End Property
------------------------------------------------------------
ASP Code:
------------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<form action = "query_detail.asp" method = "post"></form>
<body>
<%
dim detail_object
dim ls_Detail_String
set detail = server.createobject("Get_Detail.details")
detail.connection_string "DSN=class" <--- Fails Here
detail.make_connection
ls_Detail_string = detail.get_details(16112, 3)
response.write ls_detail
%>
</form>
</body>
</html>
------------------------------------------------------------
Thanks in advance.
Lenin
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
|