delphi連資料庫

aishu521發表於2013-01-22

插入資料 

sql_str:='insert into clickdbxk..checkresult(ModStation,GoodId,userid,createdate,creatime,result,Spec,GoodName ,side,BOMSiteID, ProgramName,MatchineName,PlaceExplain) ';
  sql_Str:=sql_Str+' values('''+station+''','''+lotnum+''','''+userid+''','''+createdate+''','''+creatime+''','''+sresult+''','''+Spec+''','''+GoodName+''' ,1,'''+BOMSiteID+''', '''+ProgramName+''','''+MatchineName+''','''+PlaceExplain+''') ' ;

//   ADOQuery2.Connection:=frmmain.ADOConnection1   

 ADOQuery2.Close;
    ADOQuery2.SQL.Clear;

    ADOQuery2.SQL.Text:=sql_Str;
    try
       ADOQuery2.ExecSQL;
    except
       v_result:=false;
       adoquery2.Free;
    end;

//sql2000
   {ADOConnection1.Close;
   ADOConnection1.ConnectionString:='Provider=SQLOLEDB.1;Password=sa123;Persist Security Info=True;'
           +' User ID=sa;Initial Catalog=ClickDBXK;Data Source=127.0.0.1';  //Data Source=THX-LAB902

    ADOConnection1.LoginPrompt:=False;

    ADOConnection1.Open;   }

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15187685/viewspace-753084/,如需轉載,請註明出處,否則將追究法律責任。

相關文章