ADOConnection2.Close ;
ADOConnection2.ConnectionString:='Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog='+edit1.text+';Data Source='+s;
ADOConnection2.Open ;
adoquery2.close;
adoquery2.sql.clear;
adoquery2.SQL.Add('CREATE PROCEDURE backupdatabase ( @road char(50),@database char(20) ) AS backup database @database to disk =@road with init,stats');
adoquery2.execsql;
adoquery2.Close;
adoquery2.SQL.Clear ;
adoquery2.SQL.Add('CREATE PROCEDURE restoredatabase ( @road char(50),@database char(20)) AS restore database @database from disk=@road with replace');
adoquery2.ExecSQL ;
其中edit1.text为新建数据库名称!