Разработка системы сохранения результатов анкетирования в базе данных MS SQL Server
Курсовой проект - Компьютеры, программирование
Другие курсовые по предмету Компьютеры, программирование
?ия приложения
Список используемой литературы
1.Программирование в Delphi. Учебник по классическим теориям Delphi. - ООО Бином-Пресс 2006г.
2..-2006">Разработка клиент-серверных приложений в Delphi А. Шкрыль БХВ-Петербург 2006г
3. SQL: Полное руководство Джеймс Р. Грофф, Пол Н. Вайнберг Издательство: Ирина, Издательская группа BHV, McGraw-Hill Companies 2001г.
Приложение А (обязательное)
Листинг программы
program Anketa;
uses,in MainForm.pas {Form1},in Unit1.pas {AboutForm},in Unit2.pas {InfoForm};
{$R *.res}.Initialize;.Title := Анкета;.CreateForm(TForm1, Form1);.CreateForm(TAboutForm, AboutForm);.Run;.MainForm;, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,, StdCtrls, Grids, DBGrids, DB, ADODB,, ComCtrls, Menus, Vcl.XPMan;= class(TForm): TDataSource;: TADOQuery;: TDBGrid;: TButton;: TLabel;: TLabel;: TLabel;: TEdit;: TEdit;: TEdit;: TRadioGroup;: TLabeledEdit;: TLabeledEdit;: TLabel;: TComboBox;: TLabel;: TComboBox;: TLabel;: TComboBox;: TRichEdit;: TLabel;: TLabeledEdit;: TRichEdit;: TLabel;: TComboBox;: TLabel;: TLabeledEdit;: TRichEdit;: TLabel;: TLabel;: TComboBox;: TLabeledEdit;: TPanel;: TRadioGroup;: TPanel;: TPanel;: TPanel;: TButton;: TButton;: TMainMenu;: TMenuItem;: TMenuItem;: TMenuItem;: TMenuItem;: TMenuItem;: TMenuItem;PriorButtonClick(Sender: TObject);NextButtonClick(Sender: TObject);FormCreate(Sender: TObject);SaveButtonClick(Sender: TObject);BdataKeyPress(Sender: TObject; var Key: Char);N5Click(Sender: TObject);N1Click(Sender: TObject);N3Click(Sender: TObject);N2Click(Sender: TObject);
{ Private declarations }: integer;;: TForm1;:integer; //номер активной панели:boolean;Unit1, Unit2;
{$R *.dfm}definitionId: integer;//возвращает значение следующего ID анкеты.ado.SQL.Clear;.ado.SQL.Text:=select id from table_1 ORDER BY id ASC;;.ado.open;.ado.Last;:=Form1.ado.Fields[0].value+1;result:=1;;;NewANKETA; .FormCreate(Form1);Form1 do.Clear;.Clear;.Clear;.ItemIndex:=-1;.Clear;.Clear;.Clear;.ItemIndex:=-1;.ItemIndex:=-1;.ItemIndex:=-1;.ItemIndex:=-1;.ItemIndex:=-1;.ItemIndex:=-1;.Clear;.Clear;.Clear;.Clear;.Clear;.NextButton.Visible:=true;.savebutton.Enabled:=false;;;Smena(l:integer);l of
: begin.Panel1.Visible:=true;.Panel2.Visible:=false;.Panel3.Visible:=false;.Panel4.Visible:=false;.PriorButton.Visible:=false;.NextButton.Visible:=true;;
: begin.Panel1.Visible:=false;.Panel2.Visible:=true;.Panel3.Visible:=false;.Panel4.Visible:=false;.PriorButton.Visible:=true;.NextButton.Visible:=true;;
: begin.Panel1.Visible:=false;.Panel2.Visible:=false;.Panel3.Visible:=true;.Panel4.Visible:=false;.PriorButton.Visible:=true;.NextButton.Visible:=true;;
1thenl:=l-1;(l);;TForm1.NextButtonClick(Sender:TObject);:boolean;:=false;l1 then l:=l-1;(l);;TForm1.NextButtonClick(Sender: TObject);:boolean;:=false;l<4 then l:=l+1;l of
: beginPolgroup.ItemIndex=-1 then begin ShowMessage(Вы не указали пол!); error:=true; end;(Bdata.Text);(0,Неверный формат даты!+#13#10+Пример правильного ввода +#13#10+ 01.01.2012 ,Неверная дата,MB_Ok or MB_ICONERROR);:=true;.Clear;;error then l:=1;;
:beginTimeGamebox.ItemIndex=-1 then begin ShowMessage(Вы не указали сколько времени тратите на игры!); error:=true; end;OpitGamebox.ItemIndex=-1 then begin ShowMessage(Вы не указали как вы оцениваете свой игровой опыт!); error:=true; end;Platformerbox.ItemIndex=-1 then begin ShowMessage(Вы не указали как относитесь к платформерам!); error:=true; end;Pristavkagroup.ItemIndex=-1 then begin ShowMessage(Вы не указали есть ли у вас приставка!);error:=true; end;error then l:=2;;
:beginOsbox.ItemIndex=-1 then begin ShowMessage(Вы не указали свою ОС!); error:=true; end;error then l:=3;;;Not error then smena(l);;TForm1.FormCreate(Sender: TObject);.Visible:=true;.Visible:=false;.Visible:=false;.Visible:=false;.Visible:=false;:=false;:=1;.savebutton.Enabled:=false;;TForm1.SaveButtonClick(Sender: TObject);: boolean;:=false;Donatbox.ItemIndex=-1 then begin ShowMessage(Вы не указали тратите ли вы деньги на игры); error:=true; end;
if (povtorSave)and(messagebox(0,Возможно вы пытаетесь сохранить уже существующие данные!+#13#10+В этом случае они будут сохранены под новым номером! Продолжить?,Повторное сохранение,MB_YesNo or MB_ICONINFORMATION)=mrNo) then error:=true;(not error) then begin:=DefinitionId;.SQL.Text:=insert into table_1 (ID, name, fam,otch,pol,datar,professia,TimeGame,OpitGame, GanrGame, Platformer, OS, ConfigPC, Pristavka, Game, GameInfo, Donat, Film, Info);.SQL.add( values (:ID, :name, :fam,:otch,:pol,:datar,:professia,:TimeGame,:OpitGame, :GanrGame, :Platformer, :OS, :ConfigPC, :Pristavka, :Game, :GameInfo, :Donat, :Film, :Info));.Parameters.ParamByName(name).value:=NameEdit.Text;.Parameters.ParamByName(fam).value:=lNameEdit.Text;.Parameters.ParamByName(otch).value:=mNameEdit.Text;.Parameters.ParamByName(pol).value:=PolGroup.ItemIndex;.Parameters.ParamByName(professia).value:=professia.Text;.Parameters.ParamByName(DataR).value:=formatdatetime(yyyy/mm/dd,StrToDateTime(Bdata.Text));.Parameters.ParamByName(GanrGame).value:=GanrGame.Text;.Parameters.ParamByName(TimeGame).value:=TimeGamebox.ItemIndex;.Parameters.ParamByName(OpitGame).value:=OpitGamebox.ItemIndex;.Parameters.ParamByName(Donat).value:=Donatbox.ItemIndex;.Parameters.ParamByName(Platformer).value:=Platformerbox.ItemIndex;.Parameters.ParamByName(Pristavka).value:=PristavkaGroup.ItemIndex;.Parameters.ParamByName(OS).value:=OSBox.items[Osbox.ItemIndex];.Parameters.ParamByName(Game).value:=Game.Text;.Parameters.ParamByName(film).value:=FilmEdit.Text;.Parameters.ParamByName(ConfigPC).value:=ConfigPCEdit.Text;.Parameters.ParamByName(GameInfo).value:=GameInfoEdit.Text;.Parameters.ParamByName(info).value:=InfoEdit.Text;.Parameters.ParamByName(id).value:=id;.ExecSQL; povtorSave:=true;(0,Данные успешно сохранены!,Сохранение,MB_Ok or MB_ICONINFORMATION);
except(Ошибка при записи данных!);
end;else messagebox(0,Данные не сохранены,Сохранение,MB_Ok or MB_ICONERROR);;TForm1.BdataKeyPress(Sender: TObject; var Key: Char);: set of char=[0..9,#8,.];(not(key in abc)) then key:=#0;;TForm1.N5Click(Sender: TObject);.ShowModal;;TForm1.N1Click(Sender: TObject);;;TForm1.N3Click(Sender: TObject);.Close;;TForm1.N2Click(Sender: TObject);.CreateForm(TInfoForm, InfoForm);.ShowModal;;.Unit1;, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,, StdCtrls, jpeg, ExtCtrls;= class(TForm): TLabel;: TLabel;: TLabel;: TButton;: TImage;
{ Private declarations }
{ Public declarations };: TAboutForm;
{$R *.dfm}.Unit2;, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,, StdCtrls, Grids, DB, ADODB, DBGrids;= class(TForm): TStringGrid;: TButton;: TButton;: TDataSource;: TDBGrid;: TADOQuery;: TLabel;: TButton;: TLabel;: TButton;: TLabel;: TEdit;FormCreate(Sender: TObject);PriorButtonClick(Sender: TObject);NextButtonClick(Sender: TObject);CloseButtonClick(Sender: TObject);Button1Click(Sender: TObject);
{ Private declarations }
{ Public declarations };: TInfoForm;Mainform;
{$R *.dfm}SelectInfo;InfoForm do.Cells[1,0]:=ado.FieldByName(id).AsString;.Cells[1,1]:=ado.FieldByName(name).AsString;.Cells[1,2]:=ado.FieldByName(fam).AsString;.Cells[1,3]:=ado.FieldByName(Otch).AsString;ado.FieldByName(pol).AsBoolean then InfoGrid.Cells[1,4]:=Женский else InfoGrid.Cells[1,4]:=Мужской;.Cells[1,5]:=ado.FieldByName(professia).AsString;.Cells[1,6]:=ado.FieldByName(DataR).Asstring;.Cells[1,7]:=Form1.TimeGameBox.Items[ado.FieldByName(TimeGame).AsInteger];.Cells[1,8]:=Form1.OpitGameBox.Items[ado.FieldByName(OpitGame).AsInteger];.Cells[1,9]:=ado.FieldByName(GanrGame).AsString;.Cells[1,10]:=Form1.PlatformerBox.Items[ado.FieldByName(Platformer).Asinteger];.Cells[1,11]:=ado.FieldByName(OS).AsString;.Cells[1,12]:=ado.FieldByName(ConfigPC).AsString;.Cells[1,13]:=Form1.P