none
asp和sqlserver的一个问题!! RRS feed

  • 问题

  • 一个文本框!当我输入数字时程序正常!但是当我输入英文或中文时就出错了!!

    错误类型:
    Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
    [Microsoft][ODBC SQL Server Driver][SQL Server]列名 '(此处是文本框输入的英文或中文)' 无效。
    请问这是什么情况!?其他的文本框都没有问题!!

    数据库表里的类型也全都是nvarchar。。

    以下是提取部分的代码

    if request("action")="insert" then

     dim sql,id,i id=split((request("question")),",")

    for i=0 to ubound(id)

    sql="insert into teacherselect(question,type,answer,difficult,a,b,c,d,subjectname) select "

    sql=sql & "(select question from question where id=" & id(i) & ") as a1,"

    sql=sql & "(select type from question where id=" & id(i) & ") as a2,"

    sql=sql & "(select answer from question where id=" & id(i) & ") as a3,"

    sql=sql & "(select difficult from question where id=" & id(i) & ") as a4,"

    sql=sql & "(select a from question where id=" & id(i) & ") as a5,"

    sql=sql & "(select b from question where id=" & id(i) & ") as a6,"

    sql=sql & "(select c from question where id=" & id(i) & ") as a7,"

    sql=sql & "(select d from question where id=" & id(i) & ") as a8,"

    sql=sql & "" & cstr(trim(request("subjectname"))) & "" conn.execute(sql)

    2011年11月1日 9:50

答案

  •  id=split((request("question")),",")

     

    你输入的这个id需要是数字串(数字类型数组),不能是字符或者其他。所以报错。


    family as water
    2011年11月1日 11:15