Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New to the CF scene
    Join Date
    Aug 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Delphi ADOQuerie help needed

    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:
    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:
    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:
    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:
    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:



    Can anybody help me out here? I'm clueless.
    Last edited by WiK1d; 08-25-2008 at 04:33 PM.


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •