Hello,
Question: How can I use ADO within a VB Script function?
Problem:
I'm useing a drop down menu to select the type of info to search for in a dbf file. Upon selection of the info type, it calls a vbscript that will execute the proper function based on the users selection. Within the vbscript, I want it to connect useing ADO to dbf file (using ODBC DSN connection) for further selections. However my problem is that an error keeps comming up with the ADO script.
If I use: Set conn = Server.CreateObject("ADODB.Connection"
Then I get the error: Error: Object required: 'Server'
or if I use: Set conn = New ADODB.Connection
I get the error: Error: Class not defined: 'ADODB'
Here is the entire vbscript I use:
<head>
<script language="vbscript">
<!--
Sub getMore(types)
Dim sql
sql = "SELECT Item.Product, Item.Manufact, Item.Type FROM Item WHERE ((Item.Type)='" & types & "');"
Set conn = Server.CreateObject("ADODB.Connection"
DSNtemp = "item"
conn.Open DSNtemp
Set rs = conn.Execute(sql, 3, 3)
response.write("msgbox(""" & rs("Product" & """, vbokonly, ""Products"""
Set rs = nothing
conn.Close
Set conn = nothing
End Sub
-->
</script>
</head>
<body>
<FORM name='selection' method='post' action='done.asp'>
<SELECT NAME='type' id='selectType' onChange='getMore(document.selection.type.value)'>
<OPTION value=''></OPTION>
<OPTION value='Software'>Software</OPTION>
<OPTION value='Network Card'>Network Card</OPTION>
<OPTION value='Printer'>Printer</OPTION>
<OPTION value='Laptop'>Laptop</OPTION>
</SELECT>
<BR>
<DD><Input type='submit' value='Submit'><Input type='Reset' Value='Reset'>
</FORM>
</body>
Can anyone tell me how to do this properly?
Thanks in advance!
-Ovatvvon
Question: How can I use ADO within a VB Script function?
Problem:
I'm useing a drop down menu to select the type of info to search for in a dbf file. Upon selection of the info type, it calls a vbscript that will execute the proper function based on the users selection. Within the vbscript, I want it to connect useing ADO to dbf file (using ODBC DSN connection) for further selections. However my problem is that an error keeps comming up with the ADO script.
If I use: Set conn = Server.CreateObject("ADODB.Connection"
Then I get the error: Error: Object required: 'Server'
or if I use: Set conn = New ADODB.Connection
I get the error: Error: Class not defined: 'ADODB'
Here is the entire vbscript I use:
<head>
<script language="vbscript">
<!--
Sub getMore(types)
Dim sql
sql = "SELECT Item.Product, Item.Manufact, Item.Type FROM Item WHERE ((Item.Type)='" & types & "');"
Set conn = Server.CreateObject("ADODB.Connection"
DSNtemp = "item"
conn.Open DSNtemp
Set rs = conn.Execute(sql, 3, 3)
response.write("msgbox(""" & rs("Product" & """, vbokonly, ""Products"""
Set rs = nothing
conn.Close
Set conn = nothing
End Sub
-->
</script>
</head>
<body>
<FORM name='selection' method='post' action='done.asp'>
<SELECT NAME='type' id='selectType' onChange='getMore(document.selection.type.value)'>
<OPTION value=''></OPTION>
<OPTION value='Software'>Software</OPTION>
<OPTION value='Network Card'>Network Card</OPTION>
<OPTION value='Printer'>Printer</OPTION>
<OPTION value='Laptop'>Laptop</OPTION>
</SELECT>
<BR>
<DD><Input type='submit' value='Submit'><Input type='Reset' Value='Reset'>
</FORM>
</body>
Can anyone tell me how to do this properly?
Thanks in advance!
-Ovatvvon