Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8331713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:29:51+00:00 2026-06-09T02:29:51+00:00

I have a user registration process which stores user info to my database using

  • 0

I have a user registration process which stores user info to my database using MYDAC components. Currently it allow duplicate users, which is not my intention. My code is below, but I don’t know where the problem is.

procedure TForm1.Button1Click(Sender: TObject);
begin    
  if (edit1.Text <> '') and (edit2.Text <> '') and (edit3.Text <> '') and 
    (edit4.Text <> '') then
  begin
    MyQuery1.Close;
    MyQuery1.SQL.Text := 'select * from uyeler '+
                         'where nick=:0 and mail=:0 and site=:0';

    MyQuery1.Params[0].AsString:=edit1.text;
    MyQuery1.Params[0].AsString:=edit2.text;
    MyQuery1.Params[0].AsString:=edit3.text;

    MyQuery1.open;

    if MyQuery1.RecordCount = 0 then
      MessageDlg('The same information! Try again.', mtError, [mbOK], 0)
    else
      MyQuery1.Close;

    MyQuery1.SQL.Text := 'INSERT INTO uyeler (nick, mail, site, sifre) VALUES '+
                                            '(:nick, :mail, :site, :sifre)';

    MyQuery1.ParamByName('nick').AsString := Edit1.text;
    MyQuery1.ParamByName('mail').AsString := Edit2.text;
    MyQuery1.ParamByName('site').AsString := Edit3.text;
    MyQuery1.ParamByName('sifre').AsString := Edit4.text;
    MyQuery1.Execute;

    Button1.Enabled := False;
    MessageDlg('Mission complate!', mtInformation, [mbOK], 0);

    Edit1.Clear;
    Edit2.Clear;
    Edit3.clear;
    Edit4.Clear;

    PageControl2.Visible := False;
    PageControl1.Visible := True;
  end
  else
  begin
    MessageDlg('Information is missing! Try again.', mtWarning,[mbOK],0);    
  end;
end;

How can I prevent signing up with the same? What should I do in this case?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T02:29:53+00:00Added an answer on June 9, 2026 at 2:29 am

    IMO the answer posted by @Ken White should work fine, but since you are finding troubles. I suggest you to try with this code. Its just the difference in the executing the queries.

    I am considering the field datatypes to be Char or VarChar, hence ” ” while entering the data values

    procedure TForm1.Button1Click(Sender: TObject);
    begin
      Button1.Enabled:=false;
    
      if (edit1.Text <> '') and (edit2.Text <> '') and 
         (edit3.Text <> '') and (edit4.Text <> '') then
      begin
        MyQuery1.SQL.Clear;
        MyQuery1.SQL.Add(' select* from uyeler where nick="'+edit1.text+'"' +
                          'and mail="'+edit2.text+'" and site="'+edit3.text+'"');
        MyQuery1.Execute;
    
        if not MyQuery1.IsEmpty then   //--- can also use MyQuery1.RecordCount >0 
          MessageDlg('The same information! Try again.', mtError,[mbOK],0)
        else
        begin            //--- no duplicates present 
          MyQuery1.SQL.Clear;
          MyQuery1.SQL.Add(' INSERT INTO uyeler (nick, mail, site, sifre) VALUES '+
                                '("'+edit1.text+'", "'+edit2.text+'","'+edit3.text+'", "'+edit4.text+'")');
    
         try
            MyQuery1.Execute;
          finally
            MyQuery1.SQL.Clear;
          end;
    
         MessageDlg('Mission complate!', mtInformation,[mbOK],0);
    
         Edit1.Clear;
         Edit2.Clear;
         Edit3.clear;
         Edit4.Clear;
    
         PageControl2.Visible:=false;
         PageControl1.Visible:=true;
        end;                        
      end;                 
      else
       MessageDlg('Information is missing! Try again.', mtWarning,[mbOK],0);
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a user registration process in which I send an email to the
I'm using Zend Framework and I currently have an existing form using zend-form which
I have a web application which basically process entries of the user when the
I have a user registration form in my Django application which collects additional data
I have a user registration Form. If a new User register their account in
Let's say I have an user registration form. In this form, I have the
I have to do a user registration form (classical layout with two columns, labels
I have developed a web site that requires user registration and authentication for some
I have such view that handles user registration. After creating new user i want
I want to make a user-registration form where I will have fields such first

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.