Opening an SQL table in a function
How do I open a table in a procedure?
I creating a connection to my sql server on the header of the ASP code with the following string and I have no problem with this.
However, when I want to open a AGENT table in a function, I am getting an error.
Here is my code.
ASP PAGE:
<%
'**to set field value
sqlvarMarket= "SELECT TOP 100 PERCENT MarketStaffID,MarketAreaCode, MarketDescription FROM dbo.MarketAreaTable ORDER BY MarketDescription"
Set revarMarket = conn.Execute(sqlvarMarket) %>
HERE IS PART OF THE BODY:
<select name="selectMarket" size="1" style="width:150;COLOR:#669966;">
<option value=0 selected>Market....</option>
<% do until reMarket.EOF
response.write "<option value= " & reMarket("MarketAreaCode") & "> " & reMarket("MarketDescription") & "</option>"
reMarket.MoveNext
loop
reMarket.close
Set reMarket = Nothing
%>
this is where I get the error
HERE IS THE FUNCTION CALLED WHEN THE selectMarket FIELD IS CHANGED:
Function selectMarket_OnChange
y=Document.form1.selectMarket.value
sqlAgent="SELECT TOP 100 PERCENT EnteredBy, id AS AgentID, Company FROM dbo.AgentInformation WHERE MarketID=" & y
sqlAgent=sqlAgent & " ORDER BY EnteredBy, Company"
set reAgent=conn.execute(sqlAgent)
End Function
HERE IS THE CONTENT OF THE CONNECTDB.TXT
Set conn = Server.CreateObject(ADODB.Connection)
conn.ConnectionTimeout = 30
conn.CommandTimeout = 30
conn.Open (my connection string)
|