---------------------------------------------
Кто удалит - Убью! Мне на конкурс!
Сообщений 1 страница 6 из 6
Поделиться22012-03-26 22:44:35
SQLLLLL
rocedure TForm4.Button1Click(Sender: TObject);
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('CREATE TABLE '+edit1.text+'(№Билета int, Фамилия VARCHAR(15), Имя VARCHAR(10), Отчество VARCHAR(15),Адрес VARCHAR(50), Телефон VARCHAR(11), Email VARCHAR(25) );');
ADOQuery1.ExecSQL;
showmessage('Таблица успешно создана!');
adotable1.Active:=false;
adotable1.TableName:=edit1.text;
adotable1.Active:=true;
end;
procedure TForm4.Button2Click(Sender: TObject);
begin
adotable1.Active:=false;
adotable1.TableName:=combobox1.text;
adotable1.Active:=true;
end;
procedure TForm4.Button3Click(Sender: TObject);
var st:string;
begin
st:=combobox2.Text;
if st<>'ВЫБЕРИТЕ ПОЛЕ ДЛЯ ПОИСКА' then begin
if not adoTable1.Locate(st, Edit2.Text, [loCaseInsensitive,
loPartialKey]) then
ShowMessage('Запись не найдена');
end;
end;
procedure TForm4.FormActivate(Sender: TObject);
begin
Onactivate:=nil;
adoconnection1.GetTableNames(combobox1.Items,false);
end;
procedure TForm4.FormShow(Sender: TObject);
begin
Onactivate:=nil;
adoconnection1.GetTableNames(combobox1.Items,false);
end;
end.
Поделиться32012-03-26 22:45:16
unit Unit5;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ADODB, DB, jpeg, ExtCtrls, DBCtrls, Grids, DBGrids;
type
TForm5 = class(TForm)
Image1: TImage;
ADOConnection1: TADOConnection;
ADOQuery1: TADOQuery;
Button2: TButton;
Bevel1: TBevel;
Edit1: TEdit;
ComboBox2: TComboBox;
ComboBox1: TComboBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
DBGrid1: TDBGrid;
DBNavigator1: TDBNavigator;
ADOTable1: TADOTable;
DataSource1: TDataSource;
ADOConnection2: TADOConnection;
Button1: TButton;
procedure Button2Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form5: TForm5;
implementation
uses Unit4, Unit6;
{$R *.dfm}
procedure TForm5.Button1Click(Sender: TObject);
begin
form6.show;
end;
procedure TForm5.Button2Click(Sender: TObject);
var st:string; x:integer; i:integer;
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
st:=combobox1.text;
x:=length(st);
for i:=1 to x do begin
if st[i]=' ' then delete(st,i,1);
end;
combobox1.text:=st;
st:=combobox2.text;
x:=length(st);
for i:=1 to x do begin
if st[i]=' ' then delete(st,i,1);
end;
combobox2.text:=st;
st:=edit1.text;
x:=length(st);
for i:=1 to x do begin
if st[i]=' ' then delete(st,i,1);
end;
edit1.text:=st;
ADOQuery1.SQL.Add('CREATE TABLE '+combobox1.Text+'_'+combobox2.Text+'_'+edit1.Text+'( Преподаватель VARCHAR(20), Студент VARCHAR(20), Дата DATETIME, Оценка int, Примечание VARCHAR(25) );');
ADOQuery1.ExecSQL;
showmessage('Таблица успешно создана!');
adotable1.TableName:=combobox1.Text+'_'+ combobox2.Text+'_'+edit1.Text;
adotable1.Active:=true;
end;
procedure TForm5.FormActivate(Sender: TObject);
begin
onactivate:=nil;
adoconnection2.GetTableNames(combobox1.items,false);
end;
procedure TForm5.FormShow(Sender: TObject);
begin
adoconnection2.GetTableNames(combobox1.items,false);
end;
end.
Поделиться42012-03-26 22:46:23
-------------------------------------------------------------
ПОИСК
------------------------------------------------------------
procedure TForm3.Button1Click(Sender: TObject);
var st:string;
begin
st:=combobox1.Text;
if st<>'ВЫБЕРИТЕ ПОЛЕ ДЛЯ ПОИСКА' then begin
if not adoTable1.Locate(st, Edit1.Text, [loCaseInsensitive,
loPartialKey]) then
ShowMessage('Запись не найдена');
end;
end;
end.
Поделиться52012-03-26 22:47:32
--------------------------------------------------------
ФИЛЬТРАЦИЯ
--------------------------------------------------------
procedure TForm7.ADOTable1FilterRecord(DataSet: TDataSet; var Accept: Boolean);
begin
Accept := DataSet['Студент']=dblookupcombobox1.Text;
end;
procedure TForm7.Button1Click(Sender: TObject);
var str:string; gr:string; i:integer;
begin
adotable1.Active:=false;
adotable1.TableName:=combobox1.Text;
str:=combobox1.text;
for I := 1 to length(str) do begin
if str[i]='_' then break;
gr:=gr+str[i];
end;
adotable2.Active:=false;
adotable2.TableName:=gr;
adotable2.Active:=active;
button2.Visible:=true;
dblookupcombobox1.Visible:=true;