数据库是oracle的
居然不会写sql了
  sql := 'Insert into Department values('+ IntToStr(DepartM.Dept_ID)+','''+
        DepartM.Dept_Name+''','''+DepartM.Leader1+''','''+
        DepartM.Leader1_Mobile+''','''+DepartM.Leader2+''','''+
        DepartM.Leader2_Mobile+''');'; 
//老是报这句出错

解决方案 »

  1.   

    忘记说了数据库字段类型了,
    IntToStr(DepartM.Dept_ID)第一个字段是number型其他字段都是字符型varchar2
      

  2.   

    执行插入前用showmessage()看看SQL语句
      

  3.   

    sql := 'Insert into Department values('+ IntToStr(DepartM.Dept_ID)+','+
            quotedstr(DepartM.Dept_Name)+','+quotedstr(DepartM.Leader1)+','+
            quotedstr(DepartM.Leader1_Mobile)+','+quotedstr(DepartM.Leader2)+','+
            quotedstr(DepartM.Leader2_Mobile)+')';
      

  4.   

    这句还是编译通不过sql := 'Insert into Department values('+ IntToStr(DepartM.Dept_ID)+','+
            quotedstr(DepartM.Dept_Name)+','+quotedstr(DepartM.Leader1)+','+
            quotedstr(DepartM.Leader1_Mobile)+','+quotedstr(DepartM.Leader2)+','+
            quotedstr(DepartM.Leader2_Mobile)+')';
      

  5.   

    undeclared identifier:'IntToStr'
    undeclared identifier:'quotedstr'
    要使用的些字符型函数要象c那样引用同头文件引用一些东西吗?
      

  6.   

    唉,终于知道了,没有引用SysUtils
      

  7.   

    mygod,我说了看你的sql语句应该没有问题的,最有可能的是多少引号罢了
    你这个是新建的unit吧?不然怎么没有引用这个unit
      

  8.   

    IntToStr
    quotedstr
    这两个函数的头文件是不是都在SysUtils里有定义呀
    才学del的,拜托
      

  9.   

    我负责写dal层啊,才学了两天delphi,什么也不知道的,我在qq群了,都问人家是不是会要象c那样呀使用函数就要引用头文件,他们都没回答出来,晕倒一片
      

  10.   

    你可在这个方法上面按f1,上面有具体该方法所在的unit
      

  11.   

    不过这两个在你说的那个unit当中,好好使用delphi的帮助,你会很快掌握的,delphi的特点就是上手快