Delphi ADOQuery help needed

Get help on programming - C++, Java, Delphi, etc.
Post Reply
WiK1d
Registered User
Posts: 20732
Joined: 13 Sep 2004, 02:00
Location: Cruising the streets of Pretoria
Contact:

Delphi ADOQuery help needed

Post by WiK1d »

Hey guys, I'm in school and have to do a project in delphi with Queries. Thing is, I have no idea what's wrong with my program.

I have a database with 3 tables and I need to input info into them via code in delphi. I guess I must have done something very wrong, but I can't figure out what.

This is the code for the 3 inputs (Another question, can you do 3 inputs into one database via different tables on one procedure?)

Code: Select all

qryRegistrasie.Active := False;
  sString := 'INSERT INTO leerder ';
  sString := sString + '(ID, ';
  sString := sString + 'Leerder_Titel, ';
  sString := sString + 'Leerder_Van, ';
  sString := sString + 'Leerder_VolNaam, ';
  sString := sString + 'Leerder_Naam, ';
  sString := sString + 'Leerder_ID, ';
  sString := sString + 'Leerder_Geboorte, ';
  sString := sString + 'Leerder_Geslag) ';
  sString := sString + ' VALUES ';
  sString := sString + '(' + sID + ', ';
  sString := sString + sLTitel + ', ';
  sString := sString + sLVan + ', ';
  sString := sString + sLVolNaam + ', ';
  sString := sString + sLNaam + ', ';
  sString := sString + sLID + ', ';
  sString := sString + sGeboorte + ', ';
  sString := sString + sLGeslag + ')';
  //qryRegistrasie.SQL.Text := sString;
  //qryRegistrasie.Active := True;
  edtSQLL.Text := sString;

  qryRegistrasie.Active := False;
  sString := 'INSERT INTO vakke ';
  sString := sString + '(ID, ';
  sString := sString + 'Vak1, ';
  sString := sString + 'Vak1_Punt, ';
  sString := sString + 'Vak2, ';
  sString := sString + 'Vak2_Punt, ';
  sString := sString + 'Vak3, ';
  sString := sString + 'Vak3_Punt, ';
  sString := sString + 'Vak4, ';
  sString := sString + 'Vak4_Punt, ';
  sString := sString + 'Vak5, ';
  sString := sString + 'Vak5_Punt, ';
  sString := sString + 'Vak6, ';
  sString := sString + 'Vak6_Punt, ';
  sString := sString + 'Vak7, ';
  sString := sString + 'Vak7_Punt, ';
  sString := sString + 'Vak8, ';
  sString := sString + 'Vak8_Punt, ';
  sString := sString + 'Sport, ';
  sString := sString + 'Kultuur) ';
  sString := sString + 'VALUES ';
  sString := sString + '(' + sID + ', ';
  sString := sString + sVak1 + ', ';
  sString := sString + sVak1P + ', ';
  sString := sString + sVak2 + ', ';
  sString := sString + sVak2P + ', ';
  sString := sString + sVak3 + ', ';
  sString := sString + sVak3P + ', ';
  sString := sString + sVak4 + ', ';
  sString := sString + sVak4P + ', ';
  sString := sString + sVak5 + ', ';
  sString := sString + sVak5P + ', ';
  sString := sString + sVak6 + ', ';
  sString := sString + sVak6P + ', ';
  sString := sString + sVak7 + ', ';
  sString := sString + sVak7P + ', ';
  sString := sString + sVak8 + ', ';
  sString := sString + sVak8P + ', ';
  sString := sString + sSport + ', ';
  sString := sString + sKultuur + ')';
  //qryRegistrasie.SQL.Text := sString;
  //qryRegistrasie.Active := True;
  edtSQLV.Text := sString;

  qryRegistrasie.Active := False;
  sString := 'INSERT INTO naasbestaande ';
  sString := sString + '(ID, ';
  sString := sString + 'Naas_Titel, ';
  sString := sString + 'Naas_Van, ';
  sString := sString + 'Naas_Voorletters, ';
  sString := sString + 'Naas_ID, ';
  sString := sString + 'Naas_Adres1, ';
  sString := sString + 'Naas_Adres2, ';
  sString := sString + 'Naas_Poskode, ';
  sString := sString + 'Naas_Tel, ';
  sString := sString + 'Naas_Verwantskap)';
  sString := sString + ' VALUES ';
  sString := sString + '(' + sID + ', ';
  sString := sString + sNTitel + ', ';
  sString := sString + sNVan + ', ';
  sString := sString + sNVoorletters + ', ';
  sString := sString + sNID + ', ';
  sString := sString + sNAdres1 + ', ';
  sString := sString + sNAdres2 + ', ';
  sString := sString + sNPoskode + ', ';
  sString := sString + sNTel + ', ';
  sString := sString + sNVerwantskap + ')';
  //qryRegistrasie.SQL.Text := sString;
  //qryRegistrasie.Active := True;
  edtSQLN.Text := sString;
This is the results for each of the SQL statements.

Code: Select all

INSERT INTO leerder (ID, Leerder_Titel, Leerder_Van, Leerder_VolNaam, Leerder_Naam, Leerder_ID, Leerder_Geboorte, Leerder_Geslag)  VALUES ("BERRAS", "Mnr", "Ras", "Bertus", "Bertus", "9003015168086", "900301", "Manlik")

Code: Select all

INSERT INTO vakke (ID, Vak1, Vak1_Punt, Vak2, Vak2_Punt, Vak3, Vak3_Punt, Vak4, Vak4_Punt, Vak5, Vak5_Punt, Vak6, Vak6_Punt, Vak7, Vak7_Punt, Vak8, Vak8_Punt, Sport, Kultuur) VALUES ("BERRAS", "Vak 1", "0", "Vak 2", "0", "Vak 3", "0", "Vak 4", "0", "Vak 5", "0", "Vak 6", "0", "Vak 7", "0", "Vak 8", "0", "Sport", "Kultuur")

Code: Select all

INSERT INTO naasbestaande (ID, Naas_Titel, Naas_Van, Naas_Voorletters, Naas_ID, Naas_Adres1, Naas_Adres2, Naas_Poskode, Naas_Tel, Naas_Verwantskap) VALUES ("BERRAS", "Dr", "Kramer", "B", "587469521365", "596 Fred Nicholson Straat", "Wonderboom Suid", "0084", "0123301109", "Moeder")
It looks correct, but if I run the program I get this:

Image

Can anybody help me out here? I'm clueless.
User avatar
Ron2K
Forum Technical Administrator
Posts: 9050
Joined: 04 Jul 2006, 16:45
Location: Upper Hutt, New Zealand
Contact:

Re: Delphi ADOQuery help needed

Post by Ron2K »

I don't speak Delphi myself so I can't say for sure, but I would try executing each query one by one.
Kia kaha, Kia māia, Kia manawanui.
WiK1d
Registered User
Posts: 20732
Joined: 13 Sep 2004, 02:00
Location: Cruising the streets of Pretoria
Contact:

Re: Delphi ADOQuery help needed

Post by WiK1d »

I got some help on systemshock, they also said that. Tried it and still got no luck. Oh well, Ron, you can lock this :)
RuadRauFlessa
Registered User
Posts: 20576
Joined: 19 Sep 2003, 02:00
Location: Bloodbank

Re: Delphi ADOQuery help needed

Post by RuadRauFlessa »

First of all is that the DB design you have been given or did you set up the DB Schema?
Secondly where do you actually run the queries? All you do there is construct them.
:rock: :rock: :rock: :rock: :rock: :rock: :rock: :rock: :rock: :rock:
Spoiler (show)
Intel Core i7-2600k @ 3.4GHz
Corsair Vengence 2x4GB DDR3 2000MHz
Thermaltake Toughpower 850W
ASUS nVidia GTX560 1GB
CoolerMaster HAF 932
SoulBlade
Registered User
Posts: 11025
Joined: 29 Sep 2003, 02:00
Location: /\/¯¯¯¯¯\/\
Contact:

Re: Delphi ADOQuery help needed

Post by SoulBlade »

Can you post the full code?
Core i5 3550 | 8GB RAM | 500W | Samsung T260 | GTX760 OC | 4.56TB HDD space
WiK1d
Registered User
Posts: 20732
Joined: 13 Sep 2004, 02:00
Location: Cruising the streets of Pretoria
Contact:

Re: Delphi ADOQuery help needed

Post by WiK1d »

I've made so many changes to the code already, but I'll give the one where it's 3 seperate buttons for input.

Code: Select all

unit registreer_u;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Spin, ComCtrls, DB, Grids, DBGrids, ADODB, ExtCtrls;

type
  Tfrmregistrasies = class(TForm)
    dscRegistrasie: TDataSource;
    dbgTable: TDBGrid;
    qryRegistrasie: TADOQuery;
    edtSQLL: TEdit;
    edtSQLV: TEdit;
    edtSQLN: TEdit;
    pcRegistrasie: TPageControl;
    tsRegistreer: TTabSheet;
    GroupBox1: TGroupBox;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    edttitel: TEdit;
    edtvan: TEdit;
    edtvolnaam: TEdit;
    edtnaam: TEdit;
    edtID: TEdit;
    cmbgeslag: TComboBox;
    GroupBox2: TGroupBox;
    cmb1: TComboBox;
    cmb2: TComboBox;
    cmb3: TComboBox;
    cmb4: TComboBox;
    cmb5: TComboBox;
    cmb6: TComboBox;
    cmb7: TComboBox;
    cmb8: TComboBox;
    sed1: TSpinEdit;
    sed2: TSpinEdit;
    sed3: TSpinEdit;
    sed4: TSpinEdit;
    sed5: TSpinEdit;
    sed6: TSpinEdit;
    sed7: TSpinEdit;
    sed8: TSpinEdit;
    edtsport: TEdit;
    edtkultuur: TEdit;
    GroupBox3: TGroupBox;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    Label10: TLabel;
    Label11: TLabel;
    Label12: TLabel;
    Label13: TLabel;
    Label14: TLabel;
    lblverwantskap: TLabel;
    edtnaastitel: TEdit;
    edtnaasvan: TEdit;
    edtvoorletters: TEdit;
    edtnaasid: TEdit;
    edtadres1: TEdit;
    edtadres2: TEdit;
    edtkode: TEdit;
    edttel: TEdit;
    edtverwantskap: TEdit;
    btnLeerder: TButton;
    btnVakke: TButton;
    btnNaasbestaande: TButton;
    tsSorteer: TTabSheet;
    GroupBox4: TGroupBox;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    RadioGroup1: TRadioGroup;
    procedure btnLeerderClick(Sender: TObject);
    procedure RadioButton1Click(Sender: TObject);
    procedure RadioButton2Click(Sender: TObject);
    procedure btnVakkeClick(Sender: TObject);
    procedure btnNaasbestaandeClick(Sender: TObject);
    procedure RadioGroup1Click(Sender: TObject);
  private
    sID, sNVerwantskap, sNaam, sVan, sLTitel, sLVan, sLVolNaam, sLNaam, sLID, sLGeslag, sGeboorte, sVak1, sVak2, sVak3, sVak4, sVak5, sVak6, sVak7, sVak8, sVak1P, sVak2P, sVak3P, sVak4P, sVak5P, sVak6P, sVak7P, sVak8P, sSport, sKultuur, sNTitel, sNVan, sNVoorletters, sNID, sNAdres1, sNAdres2, sNPoskode, sNTel : String;
  public
    { Public declarations }
  end;

var
  frmregistrasies: Tfrmregistrasies;

implementation

{$R *.dfm}

procedure Tfrmregistrasies.btnLeerderClick(Sender: TObject);
var

  sString : String;

begin

  sLTitel := '"' + edttitel.Text + '"';
  sLVan := edtvan.Text;
  sLVolNaam := edtvolnaam.Text;
  sLNaam := '"' + edtnaam.Text + '"';
  sLID := edtID.Text;
  sLGeslag := '"' + cmbgeslag.Text + '"';

  sNaam := copy(sLVolNaam, 1, 3);
  sVan := copy(sLVan, 1, 3);
  sID := UpperCase(sNaam + sVan);
  sID := '"' + sID + '"';

  sLVan := '"' + sLVan + '"';
  sLVolNaam := '"' + sLVolNaam + '"';

  sGeboorte := copy(sLID, 1, 6);
  sLID :=  '"' + sLID + '"';
  sGeboorte := '"' + sGeboorte + '"';

  sVak1 := '"' + cmb1.Text + '"';
  sVak2 := '"' + cmb2.Text + '"';
  sVak3 := '"' + cmb3.Text + '"';
  sVak4 := '"' + cmb4.Text + '"';
  sVak5 := '"' + cmb5.Text + '"';
  sVak6 := '"' + cmb6.Text + '"';
  sVak7 := '"' + cmb7.Text + '"';
  sVak8 := '"' + cmb8.Text + '"';
  sVak1P := '"' + sed1.Text + '"';
  sVak2P := '"' + sed2.Text + '"';
  sVak3P := '"' + sed3.Text + '"';
  sVak4P := '"' + sed4.Text + '"';
  sVak5P := '"' + sed5.Text + '"';
  sVak6P := '"' + sed6.Text + '"';
  sVak7P := '"' + sed7.Text + '"';
  sVak8P := '"' + sed8.Text + '"';
  sSport := '"' + edtsport.Text + '"';
  sKultuur := '"' + edtkultuur.Text + '"';
  sNTitel := '"' + edtnaastitel.Text + '"';

  sNVan := '"' + edtnaasvan.Text + '"';
  sNVoorletters := '"' + edtvoorletters.Text + '"';
  sNID := '"' + edtnaasid.Text + '"';
  sNAdres1 := '"' + edtadres1.Text + '"';
  sNAdres2 := '"' + edtadres2.Text + '"';
  sNPoskode := '"' + edtkode.Text + '"';
  sNTel := '"' + edttel.Text + '"';
  sNVerwantskap := '"' + edtverwantskap.Text + '"';

  qryRegistrasie.Active := False;
  sString := 'INSERT INTO leerder ';
  sString := sString + '(ID, ';
  sString := sString + 'Leerder_Titel, ';
  sString := sString + 'Leerder_Van, ';
  sString := sString + 'Leerder_VolNaam, ';
  sString := sString + 'Leerder_Naam, ';
  sString := sString + 'Leerder_ID, ';
  sString := sString + 'Leerder_Geboorte, ';
  sString := sString + 'Leerder_Geslag)';
  sString := sString + ' VALUES ';
  sString := sString + '(' + sID + ', ';
  sString := sString + sLTitel + ', ';
  sString := sString + sLVan + ', ';
  sString := sString + sLVolNaam + ', ';
  sString := sString + sLNaam + ', ';
  sString := sString + sLID + ', ';
  sString := sString + sGeboorte + ', ';
  sString := sString + sLGeslag + ')';
  qryRegistrasie.SQL.Text := sString;
  qryRegistrasie.Active := True;
  edtSQLL.Text := sString;

end;

procedure Tfrmregistrasies.RadioButton1Click(Sender: TObject);
var

  sString : String;

begin

  qryRegistrasie.Active := False;
  sString := 'SELECT * FROM leerder ';
  sString := sString + 'ORDER BY Leerder_Van';
  qryRegistrasie.SQL.Text := sString;
  qryRegistrasie.Active := True;

end;

procedure Tfrmregistrasies.RadioButton2Click(Sender: TObject);
var

  sString : String;

begin
  qryRegistrasie.Active := False;
  sString := 'SELECT * FROM leerder ';
  sString := sString + 'ORDER BY Leerder_VolNaam';
  qryRegistrasie.SQL.Text := sString;
  qryRegistrasie.Active := True;
end;

procedure Tfrmregistrasies.btnVakkeClick(Sender: TObject);
var

  sString : String;

begin

  sVak1 := '"' + cmb1.Text + '"';
  sVak2 := '"' + cmb2.Text + '"';
  sVak3 := '"' + cmb3.Text + '"';
  sVak4 := '"' + cmb4.Text + '"';
  sVak5 := '"' + cmb5.Text + '"';
  sVak6 := '"' + cmb6.Text + '"';
  sVak7 := '"' + cmb7.Text + '"';
  sVak8 := '"' + cmb8.Text + '"';
  sVak1P := '"' + sed1.Text + '"';
  sVak2P := '"' + sed2.Text + '"';
  sVak3P := '"' + sed3.Text + '"';
  sVak4P := '"' + sed4.Text + '"';
  sVak5P := '"' + sed5.Text + '"';
  sVak6P := '"' + sed6.Text + '"';
  sVak7P := '"' + sed7.Text + '"';
  sVak8P := '"' + sed8.Text + '"';
  sSport := '"' + edtsport.Text + '"';
  sKultuur := '"' + edtkultuur.Text + '"';
  sNTitel := '"' + edtnaastitel.Text + '"';

  qryRegistrasie.Active := False;
  sString := 'INSERT INTO vakke ';
  sString := sString + '(ID, ';
  sString := sString + 'Vak1, ';
  sString := sString + 'Vak1_Punt, ';
  sString := sString + 'Vak2, ';
  sString := sString + 'Vak2_Punt, ';
  sString := sString + 'Vak3, ';
  sString := sString + 'Vak3_Punt, ';
  sString := sString + 'Vak4, ';
  sString := sString + 'Vak4_Punt, ';
  sString := sString + 'Vak5, ';
  sString := sString + 'Vak5_Punt, ';
  sString := sString + 'Vak6, ';
  sString := sString + 'Vak6_Punt, ';
  sString := sString + 'Vak7, ';
  sString := sString + 'Vak7_Punt, ';
  sString := sString + 'Vak8, ';
  sString := sString + 'Vak8_Punt, ';
  sString := sString + 'Sport, ';
  sString := sString + 'Kultuur) ';
  sString := sString + 'VALUES ';
  sString := sString + '(' + sID + ', ';
  sString := sString + sVak1 + ', ';
  sString := sString + sVak1P + ', ';
  sString := sString + sVak2 + ', ';
  sString := sString + sVak2P + ', ';
  sString := sString + sVak3 + ', ';
  sString := sString + sVak3P + ', ';
  sString := sString + sVak4 + ', ';
  sString := sString + sVak4P + ', ';
  sString := sString + sVak5 + ', ';
  sString := sString + sVak5P + ', ';
  sString := sString + sVak6 + ', ';
  sString := sString + sVak6P + ', ';
  sString := sString + sVak7 + ', ';
  sString := sString + sVak7P + ', ';
  sString := sString + sVak8 + ', ';
  sString := sString + sVak8P + ', ';
  sString := sString + sSport + ', ';
  sString := sString + sKultuur + ')';
  qryRegistrasie.SQL.Text := sString;
  qryRegistrasie.Active := True;
  edtSQLV.Text := sString;

end;

procedure Tfrmregistrasies.btnNaasbestaandeClick(Sender: TObject);
var

  sString : String;

begin

  sNVan := '"' + edtnaasvan.Text + '"';
  sNVoorletters := '"' + edtvoorletters.Text + '"';
  sNID := '"' + edtnaasid.Text + '"';
  sNAdres1 := '"' + edtadres1.Text + '"';
  sNAdres2 := '"' + edtadres2.Text + '"';
  sNPoskode := '"' + edtkode.Text + '"';
  sNTel := '"' + edttel.Text + '"';
  sNVerwantskap := '"' + edtverwantskap.Text + '"';

  qryRegistrasie.Active := False;
  sString := 'INSERT INTO naasbestaande ';
  sString := sString + '(ID, ';
  sString := sString + 'Naas_Titel, ';
  sString := sString + 'Naas_Van, ';
  sString := sString + 'Naas_Voorletters, ';
  sString := sString + 'Naas_ID, ';
  sString := sString + 'Naas_Adres1, ';
  sString := sString + 'Naas_Adres2, ';
  sString := sString + 'Naas_Poskode, ';
  sString := sString + 'Naas_Tel, ';
  sString := sString + 'Naas_Verwantskap)';
  sString := sString + ' VALUES ';
  sString := sString + '(' + sID + ', ';
  sString := sString + sNTitel + ', ';
  sString := sString + sNVan + ', ';
  sString := sString + sNVoorletters + ', ';
  sString := sString + sNID + ', ';
  sString := sString + sNAdres1 + ', ';
  sString := sString + sNAdres2 + ', ';
  sString := sString + sNPoskode + ', ';
  sString := sString + sNTel + ', ';
  sString := sString + sNVerwantskap + ')';
  qryRegistrasie.SQL.Text := sString;
  qryRegistrasie.Active := True;
  edtSQLN.Text := sString;

end;

procedure Tfrmregistrasies.RadioGroup1Click(Sender: TObject);
var

  sVak, sString : String;

begin

  case RadioGroup1.ItemIndex of
    0 : sVak := 'Vak1_Punt';
    1 : sVak := 'Vak2_Punt';
    2 : sVak := 'Vak3_Punt';
    3 : sVak := 'Vak4_Punt';
    4 : sVak := 'Vak5_Punt';
    5 : sVak := 'Vak6_Punt';
    6 : sVak := 'Vak7_Punt';
    7 : sVak := 'Vak8_Punt';
  end;

  qryRegistrasie.Active := False;
  sString := 'SELECT leerder.ID, ';
  sString := sString + 'Leerder_Van, ';
  sString := sString + 'Leerder_Naam, ';
  sString := sString + 'Vak1, ';
  sString := sString + 'Vak1_Punt, ';
  sString := sString + 'Vak2, ';
  sString := sString + 'Vak2_Punt, ';
  sString := sString + 'Vak3, ';
  sString := sString + 'Vak3_Punt, ';
  sString := sString + 'Vak4, ';
  sString := sString + 'Vak4_Punt, ';
  sString := sString + 'Vak5, ';
  sString := sString + 'Vak5_Punt, ';
  sString := sString + 'Vak6, ';
  sString := sString + 'Vak6_Punt, ';
  sString := sString + 'Vak7, ';
  sString := sString + 'Vak7_Punt, ';
  sString := sString + 'Vak8, ';
  sString := sString + 'Vak8_Punt ';
  sString := sString + 'FROM leerder, vakke ';
  sString := sString + 'WHERE leerder.ID = vakke.ID';
  sString := sString + ' ORDER BY ' + sVak + ' DESC';
  qryRegistrasie.SQL.Text := sString;
  qryRegistrasie.Active := True;



end;

end.
Just ignore the bits inbetween
WiK1d
Registered User
Posts: 20732
Joined: 13 Sep 2004, 02:00
Location: Cruising the streets of Pretoria
Contact:

Re: Delphi ADOQuery help needed

Post by WiK1d »

I got sorted, thanks for the troubles though :D
RuadRauFlessa
Registered User
Posts: 20576
Joined: 19 Sep 2003, 02:00
Location: Bloodbank

Re: Delphi ADOQuery help needed

Post by RuadRauFlessa »

I still say you might want to look at doing a revision of your DB schema.
:rock: :rock: :rock: :rock: :rock: :rock: :rock: :rock: :rock: :rock:
Spoiler (show)
Intel Core i7-2600k @ 3.4GHz
Corsair Vengence 2x4GB DDR3 2000MHz
Thermaltake Toughpower 850W
ASUS nVidia GTX560 1GB
CoolerMaster HAF 932
WiK1d
Registered User
Posts: 20732
Joined: 13 Sep 2004, 02:00
Location: Cruising the streets of Pretoria
Contact:

Re: Delphi ADOQuery help needed

Post by WiK1d »

RuadRauFlessa wrote:I still say you might want to look at doing a revision of your DB schema.
Don't care, it works. I get good marks. What the problem is?
RuadRauFlessa
Registered User
Posts: 20576
Joined: 19 Sep 2003, 02:00
Location: Bloodbank

Re: Delphi ADOQuery help needed

Post by RuadRauFlessa »

You might get good marks but it is not a good coding practice to try and have everything in the same table. Normalization is the name of the game. You should actually have a couple of different things which needs to change.

The leerder table is cool except I would have made the gender field an int. One byte is smaller than 1kb for every character. So you are saving 8kb instead of 1byte. That is 8192 bytes where you should only store 1. When the database starts growing you will see a notable difference. Also change the birth date to DateTime.

The vakke table is a disaster if you pick up a problem or if you have to ever extend the application. You are only making space for 7 subjects and then a sport and culture. The first thing I would do is to add an index field for the learner id. Keep the ID you have as a unique field. Then save one record for every subject. Yes that includes Sport and Culture. Also change the mark to something other than a string value. As I said for the leerder table: String fields makes your data take up more space than is actually needed. It also makes your queries slower. Also the way you have it now is a nightmare if you have to write a query to check for which subjects anyone got more that 80% or something. The trick is re-usability.

Your naasbestaande table is pretty cool as you can't really do much else with it.

leerder

Code: Select all

ID = int
Leerder_Titel = string
Leerder_Van = string
Leerder_VolNaam = string
Leerder_Naam = String
Leerder_ID = String
Leerder_Geboorte = DateTime
Leerder_Geslag = int
vakke

Code: Select all

ID = int
Leerder = int
Vak = String
Punt = float
:rock: :rock: :rock: :rock: :rock: :rock: :rock: :rock: :rock: :rock:
Spoiler (show)
Intel Core i7-2600k @ 3.4GHz
Corsair Vengence 2x4GB DDR3 2000MHz
Thermaltake Toughpower 850W
ASUS nVidia GTX560 1GB
CoolerMaster HAF 932
WiK1d
Registered User
Posts: 20732
Joined: 13 Sep 2004, 02:00
Location: Cruising the streets of Pretoria
Contact:

Re: Delphi ADOQuery help needed

Post by WiK1d »

Thanks for all the tips, but I'm definately not going to do this as a job as I hate the subject. But I'll keep it in mind :)
RuadRauFlessa
Registered User
Posts: 20576
Joined: 19 Sep 2003, 02:00
Location: Bloodbank

Re: Delphi ADOQuery help needed

Post by RuadRauFlessa »

WiK1d wrote:Thanks for all the tips, but I'm definately not going to do this as a job as I hate the subject. But I'll keep it in mind :)
As long as you learn something it is cool.

I have a nice project at the moment. I am using XML to define database structures and then mapping it to objects. From my XML I connect to a DB. Set up the queries needed. Pull the data and export it in a specified format. I love XML. It is sooo handy. My whole app is like 4 classes or so with almost no database or table specific code. Every instance is then loaded from what is described in the XML file and the code is then a scripting language. All I need to do is basically complete this framework and then I can pull flexible reports on any database. It is so coool.

But then again that is just me :twisted:
:rock: :rock: :rock: :rock: :rock: :rock: :rock: :rock: :rock: :rock:
Spoiler (show)
Intel Core i7-2600k @ 3.4GHz
Corsair Vengence 2x4GB DDR3 2000MHz
Thermaltake Toughpower 850W
ASUS nVidia GTX560 1GB
CoolerMaster HAF 932
Hex_Rated
Registered User
Posts: 3679
Joined: 19 Jan 2006, 02:00
Contact:

Re: Delphi ADOQuery help needed

Post by Hex_Rated »

Why are they teaching you Delphi? That's like one of the worst, most irritating language EVER. Why don't they teach you something like C# or Java, not some crap that you won't ever use unless you're into SM. Crazy!
DFI LanParty X48 LT-2TR
Intel Q9450 @ 3.2Ghz
Dell 24" 2408WFP | Phillips 37" 1080p
Sapphire HD4870 X2 2GB
4GB Corsair DDR-2 1066 | Thermalrite 120 Ultra Extreme | G9 Mouse | G15 Keyboard
Vista Ultimate x64
User avatar
Ron2K
Forum Technical Administrator
Posts: 9050
Joined: 04 Jul 2006, 16:45
Location: Upper Hutt, New Zealand
Contact:

Re: Delphi ADOQuery help needed

Post by Ron2K »

^^ The problem with Java is that you have to write a lot of boilerplate code to get something remotely decent functioning. Same with C# (my primary language). It's fine if you've coded before, but for someone just starting out (like WiK1d), it may not be a good idea.

I actually used to think that Java was a decent first language; however, this article has changed my mind (search for "The Pitfalls of Java as a First Programming Language" in it).

Personally, I would recommend Python as a first language. Python is really scalable - you don't have to write a lot of boilerplate code around a simple "hello world" app (as is the case with Java and Pascal), and it's self-consistent and well-designed (unlike just about every form of BASIC out there). The well-designed part is important here - it's not important that you may never use Python in the real world, but what is important is the programming concepts that you'll learn; a good programmer will take those concepts and apply them to whatever language he's using.

I can't comment on Delphi though, having never used it myself.
Kia kaha, Kia māia, Kia manawanui.
User avatar
rustypup
Registered User
Posts: 8872
Joined: 13 Dec 2004, 02:00
Location: nullus pixius demonica
Contact:

Re: Delphi ADOQuery help needed

Post by rustypup »

Ron2K wrote:this article has changed my mind (search for "The Pitfalls of Java as a First Programming Language" in it).
:lol: oh my... most drole... with all due respect ron, the ramblings of that bunch of malcontents falls far short of anything noteworthy.. the entire article smacks of "in my young day.." followed by a nourishing bowl of "real programmers used snail slime and match sticks..."... may as well demand that the only language worthy of note is assembler and have done with it..

i would concur that java is not the best first language to use, but it does make application development accessible to a larger number of people than C ever could. on top of which, while C is excellent at teaching caution, conservation and cleverness, it is also wonderful at teaching kludging, which has no cure.

python is not a programming langauge i would introduce anyone to. the habits developed there are astonishingly bad. i have met some of its adherents and they are, quite frankly, throwbacks. not all of them, but they do make the sun fora appear to be populated by a veritable horde of rocket scientists...
Most people would sooner die than think; in fact, they do so - Bertrand Russel
Post Reply