منتديات الجلفة لكل الجزائريين و العرب - عرض مشاركة واحدة - قاعدة بيانات بالسي ++
عرض مشاركة واحدة
قديم 2012-12-29, 20:58   رقم المشاركة : 8
معلومات العضو
imana
عضو مجتهـد
 
الصورة الرمزية imana
 

 

 
إحصائية العضو










افتراضي

اقتباس:
المشاركة الأصلية كتبت بواسطة __الهاوي__ مشاهدة المشاركة
أختي، لحد الآن طلبك غير واضح، فمن جهة تريدين قاعدة بيانات بالسي، ومن جهة تقولين أن لك قاعدة بيانات ويراد لك أن تنشئيها بالسي، هل هو إنشاء أم ربط؟
إن كان الهدف إنشاء قاعدة بيانات من الصفر، تحوي ما تحويه قواعد البيانات، فهذا مشروع كبير ويلزمه عشرات المبرمجين، أما إن كان ربط قاعدة بارادوكس، أكسس، سيكول سيرفر ، أوراكل...فهنا يلزمك استخدام دوال api جاهزة.
إن كان الهدف هو إنشاء تطبيق لقاعدة بيانات بسيطة من الصفر، هذا التطبيق يسمح بتسجيل البيانات وحفظها على القرص الصلب فهذا ممكن، لكنه مضني باستخدام السي دون بيئة تطوير ide كالدلفي أو فيجوال سي++.
إن كان هناك مثال نصف جاهز فحبذا لو تنشريه هنا حتى تتضح الرؤية.
صحيح فانا لم استطيع اصال ما اريد .....
انا عندي عمل تطبيقي مكون من جداول client-produit-vente وهي مملوءة وقمنا بانشاءها بالاكسيس بشكل عادي
واريد ان اقوم بعملها بالسي فمثلا اضافة موظف او حذفها او تعديل ....
نتمنى تكون فهمتني
هذا مثال بالباسكاال عن نفس العمل
وبارك الله فيييك
aprogram produit;
uses crt;
type
tproduit=record
company,designation:string[25];
mat,qnt:integer;
prix:real;
end;
fproduit=file of tproduit;

var
prod:tproduit;
fich:fproduit;
rep:char;
vmat:integer;
choix:integer;
i:longint;
x:string;
e:string;
p:integer;
trouver:boolean;
c:byte;

procedure ajout;

begin
clrscr;


rep:='O';
while (rep='O') or (rep='o') do

begin
assign (fich,'c:\degio\produit.bak');
{$I-}
reset(fich);

if ioresult > 0 then
rewrite (fich)
else
while not eof(fich) do
read(fich,prod);
{$I+}


begin

clrscr;
with prod do

begin

writeln(' FICHE DE D''ENREGISTREMENT ');

writeln;
writeln;
write(' MATRICULE : ');readln(prod.mat);
writeln;
write(' designation : ');readln(prod.designation);
writeln;
write(' company : ');readln(prod.company);
writeln;
write(' prix : ');readln(prod.prix);
writeln;

write(' qnt : ');readln(prod.qnt);
writeln;
writeln;
end;

write (fich,prod);

write (' Voulez-vous ajouter le designation d''un autre produit : O/N :');
readln(rep);
clrscr;
end;

end;
end;


{ procedure consultationindividuelle;

begin
clrscr;

rep:='O';
while (rep='O') or (rep='o') do
begin

assign(fich,'c:\degio\etudiant.bak');
reset (fich);

writeln(' -------CONSULTATION INDIVIDUELLE-------- ');
writeln;

write (' MATRICULE : ');readln(vmat); clrscr;


while not eof(fich) do


begin
read (fich,prod);

if prod.mat = vmat then

begin


writeln(' -------CONSULTATION INDIVIDUELLE-------- ');

writeln;
writeln;
writeln (' Nom : ',etud.nom);

writeln (' Prenom : ',etud.prenom);

writeln (' Date de naissance : ',etud.datenaiss);
end;
end;

if etud.mat <> vmat then

begin
writeln;
writeln(' MATRICULE INCONNU ');
writeln;
writeln;
end;

write (' Voulez-vous consulter un autre etudiant ? O/N : ');
readln (rep);
clrscr;
end;
end;


procedure consultationgenerale;
var
nom: array[1..25] of string[16];
prenom: array[1..25] of string[25];
som: array[1..25] of string;
mat: array[1..25] of string[4];
date: array[1..25] of string;
e,f,g,h:string;
j,m,n,k:integer;

begin
clrscr;
writeln (' ----------- CONSULTATION GENERALE ------------');
writeln;

assign (fich,'c:\degio\etudiant.bak');
reset(fich);
i:=0;
e:=' ';
while not eof(fich) do

begin
read (fich,etud);

begin
i:=1+i;
mat[i]:=etud.mat;
date[i]:=etud.datenaiss;
nom[i]:=etud.nom;
prenom[i]:=etud.prenom;
som[i]:=nom[i]+e+prenom[i];
end;
end;

for m:= 1 to i-1 do
for n:= m+1 to i do
if som[m] > som[n] then
begin
f:= som[m];
som[m]:=som[n];
som[n]:=f;
g:= mat[m];
mat[m]:=mat[n];
mat[n]:=g;
h:=date[m];
date[m]:=date[n];
date[n]:=h;
end;

writeln;
k:=2;
for m:=1 to i do
begin
write (mat[m]+e);
write(som[m]+e);
writeln(date[m]+e);
k:= k+2;
end;
writeln;
end;

procedure suppression;


Var
etud:tetudiant;
trouver:boolean;
etud1:fetudiant; {Vetd1 sert de fichier intermediaire lors de
la suppression de la donnee}

{ begin {Debut suppression}
{ clrscr;
writeln (' -------------- SUPPRESSION -------------');
writeln;
rep:='O';
while (rep='O') or (rep='o') do
begin
repeat
assign(fich,'c:\degio\etudiant.bak');
{$I-}
{ reset(fich);
{$I+
if IOresult<>0 then
begin
write(' L''etudiant ne figure pas dans notre fichier ');
end;
until IOresult=0;
assign(etud1,'c:\degio\corbeil.bak');
rewrite(etud1);
seek(fich,0);
write(' Entrez le Matricule SVP : ');
readln(vmat);
writeln;
writeln;

trouver:=false;

writeln(' ');
writeln;
writeln;

while not eof(fich) do

read(fich,etud);
if etud.mat= vmat then
begin
trouver:=true;
writeln(' SUPPRIME!!!!!! : ');
writeln;

write(' Nom:'); writeln(etud.nom);
write(' Prenoms:'); writeln(etud.Prenom);
write(' Date de naissance:'); writeln(etud.Datenaiss);
writeln;
writeln;
end;
begin

seek(fich,0);
while not eof(fich) do
begin
read(fich,etud);
if vmat<> etud.mat then
begin
write(etud1,etud);
end;
end;
rewrite(fich);
seek(etud1,0);
while not eof(etud1) do
begin
read(etud1,etud);
write(fich,etud);
end;
close(etud1);
erase(etud1);
end;
write (' Voulez-vous supprimer un autre etudiant ? O/N : ');
readln (rep);
clrscr;
writeln;
end;

end;





procedure Modifier;
var
trouver:boolean;
mat:string;
c:char;
begin

clrscr;


rep:='O';
while (rep='O') or (rep='o') do
begin
assign (fich,'c:\degio\etudiant.bak');
reset(fich);

trouver:=false;


write(' MATRICULE : ');
readln(mat);
writeln;
i:=0;
while(trouver=false) and (not eof(fich)) do
begin
read(fich,etud);
if etud.mat=mat then
while (rep='O') or (rep='o') do
begin

clrscr;

trouver:=true;


writeln(' ---------------------------------------- ');
writeln;
writeln;
write(' 1> Matricule:'); writeln(etud.mat);
write(' 2> Nom:'); writeln(etud.nom);
write(' 3> Prenoms:'); writeln(etud.Prenom);
write(' 4> Date de naissance:'); writeln(etud.Datenaiss);
writeln;
writeln;
writeln(' ---------------------------------------- ');
writeln;
writeln;
writeln(' Entrez le numero de l''information a modifier ');
writeln(' 1> Pour le Matricule');
writeln(' 2> Pour le nom');
writeln(' 3> Pour le prenom');
writeln(' 4> Pour la date de naissance');

writeln;
writeln;
write(' Faites votre choix SVP:');
readln(C);
Case C of
'1': begin
write(' Entrez le nouveau matricule SVP : ');
readln(etud.mat);
end;
'2': begin
write(' Entrez le nouveau nom SVP : ');
readln(etud.nom);
end;
'3': begin
write(' Entrez le nouveu prenom SVP : ');
readln(etud.prenom);
end;
'4': begin
write(' Entrez la nouvelle date de naissance SVP : ');
readln(etud.datenaiss);
end;


end;
clrscr;
write (' Voulez-vous modifier une autre donnees ? O/N : ');
readln (rep);
clrscr;
end;
i:=i+1;
end;
if trouver=true then
begin
Seek(fich,i-1);
write(fich,etud);
end
else

writeln(' MATRICULE INCONNU ');
writeln;
write (' Voulez-vous faire une autre modification ? O/N : ');
writeln;
readln(rep);
end;




end;


{*********************** DEBUT DU PROGRAMME ****************}


begin

clrscr;

rep:='O';
while (rep='O') or (rep='o') do
begin






write (' MENU ');
writeln;
writeln;

writeln (' 1 Ajout ');

writeln (' 2 Modification ');

writeln (' 3 Suppression ');

writeln (' 4 Consultation generale ');

writeln (' 5 Consultation individuelle ');

writeln (' 6 Sortie ');
writeln;
writeln;
repeat

write (' Faites Votre Choix : ');


if choix > 6 then
begin

clrscr;

write(' ERREUR Saisissez un nombre inferieur a 6 ');

end;

{$I- }
readln (choix);
{$I+}
until ioresult=0;
case choix of

1:ajout;
{ 2:modifier;
3:suppression;
4:consultationgenerale;
5:consultationindividuelle;}
6:exit;
end;
write (' Voulez-vous revenir au menu general ? O/N : ');
readln (rep);
clrscr;
end;
close (fich);

end.









رد مع اقتباس