string filesname;
filesname=abc;
表a
id 自动编号  names char(10)insert into a (names) values (filesname)错误提示:
在此上下文中不允许使用 filesname。此处只允许使用常量、表达式或变量。不允许使用列名。 
请问该怎么解决?

解决方案 »

  1.   

    filesname这个字段是一个字符型变量不能插入,如果我改成一个数字常量就可以了,但是我又要这个filesname变量值,是不是有其他的写法?
      

  2.   

    values 后面的值(filesname)能不能是变量????等等........
      

  3.   

    dim dbstring as string
    dbstring="insert into a (names) values ('" & filesname & "')"
      

  4.   

    filesname="abc";
    string dbstring 
    dbstring="insert into a (names) values ('" + filesname + "')"
      

  5.   

    string sql=@"insert into a(names) values('"+filesname+"')";