this.oleDbCommand1.CommandText = "INSERT INTO idx" +
          "(id, password)" +
            " VALUES ('" + textBox1.Text + " ', '" + textBox2.Text + " '); ";运行时候提示  into 语法错误
请问是哪错了  怎样改啊  谢谢!!~~~~

解决方案 »

  1.   

    this.oleDbCommand1.CommandText = "INSERT INTO idx" +
              " (id, password)" +
                " VALUES ('" + textBox1.Text + " ', '" + textBox2.Text + " '); ";
    这样
      

  2.   

    把sql语句后的;(末尾引号内的)去掉再试试
      

  3.   

    this.oleDbCommand1.CommandText = "INSERT INTO idx" +
              "(id, password)" +
                " VALUES ('" + textBox1.Text + " ', '" + textBox2.Text + " '); ";
    另外看下你的id字段是否是字符串类型 的..
      

  4.   

    this.oleDbCommand1.CommandText = "INSERT INTO idx" +
              "(id, password)" +
                " VALUES ('" + textBox1.Text + " ', '" + textBox2.Text + " ')";
      

  5.   

    可能是sql最后的分号有问题。
      

  6.   

    对,textBox2.Text + " '); ";改成textBox2.Text+"')";试试看,)后面的分号是不需要的
    另外,ID一般是int型的吧,那么把VALUES('"+textBox1.Text+"'"改成VALUES("+textBox1.Text+",'"+textBox.Text...
      

  7.   


    this.oleDbCommand1.CommandText = "INSERT INTO idx (id,password) values('" +
               textBox1.Text + "','" + textBox2.Text +"')";
    这样试试吧,虽然少个分号,但基本没什么区别。
      

  8.   

    id应为数值吧,把textBox1.Text两边的单引号去了this.oleDbCommand1.CommandText = "INSERT INTO idx (id,password) values(" +
               textBox1.Text + ",'" + textBox2.Text +"')";
      

  9.   

    数值型有单引号只要是数值Sql Server是可以自动转换的,除了分号外,最有可能的是你的id字段是否设成了标识,如果是标识的化表示自动填入数字,你要给它插入数据肯定会出错。