往数据库里插入一条数据,不知哪里错了。联接数据库以后
oleconnection.open
olecommand.Connection=oleconnection
myCommand=new oledbCommand("insert into yonhu(username,paassword) values(user.text,pass.text)",oleconnection)
myCommand.ExecuteNonQuery()
myCommand=nothing
oleconnection.close
oleconnection=nothing

解决方案 »

  1.   

    myCommand=new oledbCommand("insert into yonhu(username,paassword) values('"+user.text+"','"+pass.text+"')",oleconnection);
      

  2.   

    楼主的SQL不过关呀。。
    正如一楼所写。。
    user.text,pass.text是变量。。要不然你的SQL语句就变成了
    insert into yonhu(username,paassword) values(user.text,pass.text)
      

  3.   

    楼主的SQL不过关呀。。
    正如一楼所写。。
    user.text,pass.text是变量。。要不然你的SQL语句就变成了
    insert into yonhu(username,paassword) values(user.text,pass.text)
      

  4.   

    user.text,pass.text是两个文本框。应该怎么用呀
      

  5.   

    myCommand=new oledbCommand("insert into yonhu(username,paassword) values('"+user.text+"','"+pass.text+"')",oleconnection);
      

  6.   

    string strCmd = string.Format("insert into yonhu(username,password) values('{0}','{1}')",user.Text,pass.Text);
    myCommand = new OleDbCommand(strCmd,oleConnection);
    这样简单明了,给分吧