日期:2014-05-17  浏览次数:21155 次

動態select問題
無法用連線來執行此操作。內容可能已關閉或無效
set   conn     =   Server.CreateObject( "ADODB.Connection ")  
                  connstr= "Driver={SQL   Server};server=(local);DATABASE=ceshi;UID=sa;PWD=123 "
                  conn.Open   connstr
  set   rs=server.CreateObject( "ADODB.Recordset ")
  sqlstr= "insert   into   send(intention,application_name,preengage_name,preengage_time,employ_time,note,preengage_dept,auditing,auditing,carinfomation)   values( ' "&   trim(request( "txtintention "))   & " ', ' "&   trim(request( "txtapplication_name "))   & " ', ' "&   trim(request( "txtpreengage_name "))   & " ', ' "&   trim(request( "txtpreengage_time "))   &   " ', ' "&   trim(request( "txtemploy_time "))   & " ', ' "&   trim(request( "txtnote "))   & " ', ' "&   trim(request( "txtpreengage_dept "))   & " ', ' "&   trim(request( "txtauditing "))   & " ', ' "&   trim(request( "txtinfomation "))   & " ') "
其中txtinfomation是一個動態select,代碼是這麼寫的,是不是select   出了錯
<option   value= " "> 請選擇車輛信息 </option>
<%
set   re1=server.CreateObject( "ADODB.Recordset ")
sqlstr= "select   motorman,carnumber   from     car "
re1.open   sqlstr,conn,3
if   re1.recordcount   >   0   then
        re1.movefirst
        do   while     not   re1.eof
  %>
    <option> <%=re1( "motorman ")%>   -   <%=re1( "carnumber ")%> </option>
        <%
            re1.movenext
        loop
    end   if
    re1.close  
    set   re1=nothing    
    %>


------解决方案--------------------
re1.open sqlstr,conn,3


re1.open sqlstr,conn,1,1 加上游标类型和锁定类型。