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

还是再问下我这个sql语句为什么得不到结果呢
Dim   InsertTag,InsertSqlStr
        InsertTag   =   DateToStr(Now(), "YmdHIS ")&Generator(5)
        InsertSqlStr   =   "INSERT   INTO   User   (Name,Pass,AddDate,InsertTag)   VALUES   ( ' "&Name& " ', ' "&Pass& " ', ' "&Now()& " ', ' "&InsertTag& " '); "
        InsertSqlStr   =   InsertSqlStr& "select   ID   AS   UserID,InsertTag   from   User   where   InsertTag= ' "&InsertTag& " ' "
        Conn.ExeCute(InsertSqlStr)
       
        Response.Write(UserID)
==========================================
意思就是插入数据后立即得到这个自动编号id,数据插入是成功了,为什么读不出id呢

------解决方案--------------------
Dim InsertTag,InsertSqlStr
InsertTag = DateToStr(Now(), "YmdHIS ")&Generator(5)
InsertSqlStr = "INSERT INTO User (Name,Pass,AddDate,InsertTag) VALUES ( ' "&Name& " ', ' "&Pass& " ', ' "&Now()& " ', ' "&InsertTag& " '); "
InsertSqlStr = InsertSqlStr& "select ID AS UserID,InsertTag from User where InsertTag= ' "&InsertTag& " ' "
set rs=Conn.ExeCute(InsertSqlStr)

Response.Write(rs( "UserID "))
------解决方案--------------------
报错了还是什么都不显示?
user是系统保留字段,应该写成[user]