回 帖 发 新 帖 刷新版面

主题:[讨论]在用ASP向ACCESS中插入日期时间类型数据时,总是出现:类型不匹配的问题


在用ASP向ACCESS中插入日期时间类型数据时,总是出现:类型不匹配的问题   
    
  **********************************************   
  access中该字段类型设置为短日期(1995-2-15)   
    
  *********************************************   
  asp中用select生成年月日选择框,如下:   
  <select   name="uyear">   
  <%for   iy=1999   to   1920   step   -1%>   
  <option   value=<%=iy%>><%=iy%></option>   
  <%next%>   
  </select>年   
    
  <select   name="umonth">   
  <%   for   im=1   to   12%>   
  <option   value=<%=im%>><%=im%></option>   
  <%next%>   
  </select>月   
    
  <select   name="uday">   
  <%   for   id=1   to   31%>   
  <option   value=<%=id%>><%=id%></option>   
  <%next%>   
  </select>日   
    
  *************************************************   
  获取表单日期输入为   
  begindate   =request.Form("uyear")&"-"&request.Form("umonth")&"-"&request.Form("uday")   
    
  *************************************************   
  插入到access代码为:   
  rs("begindate")=begindate   
    
  **************************************************

回复列表 (共2个回复)

沙发

试试看:
rs("begindate")=cdate(begindate)

板凳

插入到access代码改为:   
  rs("begindate")="#"+begindate+"#"

我来回复

您尚未登录,请登录后再回复。点此登录或注册