C chaofan201 Unregistered / Unconfirmed GUEST, unregistred user! 2006-06-11 #2 sql数据库没作过。我这有动态建立access数据库: procedure TForm1.O1Click(Sender: TObject); var JPG:TJpegImage; Extname,Fname,path:string; CreateAccess:OleVariant; begin //动态建立数据库。(uses ComObj). CreateAccess:=CreateOleObject('ADOX.Catalog'); CreateAccess.Create('Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:/WINDOWS/Temp/db.mdb'); path := ExtractFilePath('C:/WINDOWS/Temp/'); //程序路径 ADOConnection1.Connected := False; try ADOConnection1.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=' + path + 'db.mdb' + ';Persist Security Info=False'; ADOConnection1.Connected := true; adoquery1.close; adoquery1.sql.clear; adoquery1.sql.add('create table tb ( ID autoincrement not null,CX OLEOBJECT not null)');//在数据库中建tb表,在表中建ID(自动编号)字段,和CX(OLE)字段 adoquery1.ExecSQL; except MessageBox(GetActiveWindow(), '系统错误!', '警告', MB_OK + MB_ICONWARNING); application.Terminate; end;// 数据库建立结束。 end;
sql数据库没作过。我这有动态建立access数据库: procedure TForm1.O1Click(Sender: TObject); var JPG:TJpegImage; Extname,Fname,path:string; CreateAccess:OleVariant; begin //动态建立数据库。(uses ComObj). CreateAccess:=CreateOleObject('ADOX.Catalog'); CreateAccess.Create('Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:/WINDOWS/Temp/db.mdb'); path := ExtractFilePath('C:/WINDOWS/Temp/'); //程序路径 ADOConnection1.Connected := False; try ADOConnection1.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=' + path + 'db.mdb' + ';Persist Security Info=False'; ADOConnection1.Connected := true; adoquery1.close; adoquery1.sql.clear; adoquery1.sql.add('create table tb ( ID autoincrement not null,CX OLEOBJECT not null)');//在数据库中建tb表,在表中建ID(自动编号)字段,和CX(OLE)字段 adoquery1.ExecSQL; except MessageBox(GetActiveWindow(), '系统错误!', '警告', MB_OK + MB_ICONWARNING); application.Terminate; end;// 数据库建立结束。 end;
D djrj Unregistered / Unconfirmed GUEST, unregistred user! 2006-06-11 #3 --創建臨時表可以這樣 select top 0 UserNo=convert(nvarchar(20),null), UserName=convert(nvarchar(50),null), Age=convert(integer,null), ............. into #temp --創建臨時表也可以這樣,假設Table1是已經建好的後台物理表 select top 0 * into #temp from Table1
--創建臨時表可以這樣 select top 0 UserNo=convert(nvarchar(20),null), UserName=convert(nvarchar(50),null), Age=convert(integer,null), ............. into #temp --創建臨時表也可以這樣,假設Table1是已經建好的後台物理表 select top 0 * into #temp from Table1