%
' Populating form select fields from database
' http://www.quadcomm.com
' Returns Options tags from table table with description DescField and RetID as Value
Function ExpSelectID ( table, DescField, RetID)
If IsObject(Session("SMART_conn")) Then
Set conn = Session("SMART_conn")
Else
Set conn = Server.CreateObject("ADODB.Connection")
conn.open cfg_cnstr, cfg_login, cfg_pwd
Set Session("SMART_conn") = conn
End If
Set qtmp = Server.CreateObject("ADODB.Recordset")
sql = "SELECT " & RetID & " , " & DescField & " FROM " & table
qtmp.Open sql, conn,3,3
Do While NOT qtmp.eof
%><%= qtmp(RetID) %> - <%= qtmp(DescField) %><%
qtmp.movenext
Loop
qtmp.Close
End Function
Function ExpSelectCondID ( table, DescField, RetID, Cond, MsgError)
If IsObject(Session("SMART_conn")) Then
Set conn = Session("SMART_conn")
Else
Set conn = Server.CreateObject("ADODB.Connection")
conn.open cfg_cnstr, cfg_login, cfg_pwd
Set Session("SMART_conn") = conn
End If
Set qtmp = Server.CreateObject("ADODB.Recordset")
sql = "SELECT " & RetID & " , " & DescField & " FROM " & table & " WHERE " & Cond
qtmp.Open sql, conn,3,3
If qtmp.recordcount = 0 Then
If MsgError = "" Then
%> -<%
else
%> <% Response.Write (MsgError)
End If
End If
Do While NOT qtmp.eof
%> <%= qtmp(RetID) %> - <%= qtmp(DescField) %><%
qtmp.movenext
Loop
qtmp.Close
End Function
Function ExpSelect ( table, DescField, RetID)
If IsObject(Session("SMART_conn")) Then
Set conn = Session("SMART_conn")
Else
Set conn = Server.CreateObject("ADODB.Connection")
conn.open cfg_cnstr, cfg_login, cfg_pwd
Set Session("SMART_conn") = conn
End If
Set qtmp = Server.CreateObject("ADODB.Recordset")
sql = "SELECT " & RetID & " , " & DescField & " FROM " & table
qtmp.Open sql, conn,3,3
Do While NOT qtmp.eof
%> <%= qtmp(DescField) %><%
qtmp.movenext
Loop
qtmp.Close
End Function
Function ExpSelectCond ( table, DescField, RetID, Cond)
If IsObject(Session("SMART_conn")) Then
Set conn = Session("SMART_conn")
Else
Set conn = Server.CreateObject("ADODB.Connection")
conn.open cfg_cnstr, cfg_login, cfg_pwd
Set Session("SMART_conn") = conn
End If
Set qtmp = Server.CreateObject("ADODB.Recordset")
sql = "SELECT " & RetID & " , " & DescField & " FROM " & table & " WHERE " & Cond
qtmp.Open sql, conn,3,3
Do While NOT qtmp.eof
%> <%= qtmp(DescField) %><%
qtmp.movenext
Loop
qtmp.Close
End Function
%>