出错信息,[microsoft][odbc sql server driver]没有执行可选特性
代码如下:
adocommand1.CommandText:='insert into 。。';
adocommand1.Parameters.CreateParameter('IDInfo',ftstring,pdinput,10,IDInfo);

adocommand1.Execute;

解决方案 »

  1.   

    你用的是ODBC,先配置ODBC
      

  2.   

    也可以用ADO:
    uses DB, ADODB;procedure TForm1.Button1Click(Sender: TObject);
    var
      ADOQ: TADOQuery;
    begin
      ADOQ := TADOQuery.Create(Self);
      ADOQ.Close;
      ADOQ.ConnectionString :='Provider=SQLOLEDB.1;Password=123;Persist Security '+
        'Info=True;User ID=sa;Initial Catalog=tempdb;Data Source=db';
      ADOQ.SQL.Text := 'Insert Into.........';
      ADOQ.ExecSQL;
      ADOQ.Free;
    end;
      

  3.   

    adocommand1.CommandText:='insert into CourseInfo(id,type) values(:IDInfo,:CourseType);
    adocommand1.Parameters.CreateParameter('IDInfo',ftstring,pdinput,10,IDInfo);
    adocommand1.Parameters.CreateParameter('CourseType',ftstring,pdinput,10,CourseType);
    adocommand1.Execute;
      

  4.   

    ADOCommand1.ConnectionString := 'Provider=SQLOLEDB.1;Password=123;Persist Security '+                                                      |_密码
        'Info=True;User ID=sa;Initial Catalog=tempdb;Data Source=dbServer';
                           |_用户名                |_数据库名       |_数据库机器名
    adocommand1.CommandText:='insert into CourseInfo(id,type) values(:IDInfo,:CourseType);
    adocommand1.Parameters.CreateParameter('IDInfo',ftstring,pdinput,10,IDInfo);
    adocommand1.Parameters.CreateParameter('CourseType',ftstring,pdinput,10,CourseType);
    adocommand1.Execute;