E2010 Incompatible types: 'string' and 'PAnsiChar'
Ich habe verucht ein Programm mit MySQL-Abfrage zu schreiben, bin dabei aber auf ein Problem gestoßen:
Delphi-Quellcode:
LoginName ist ein Edit-Feld! Usernam ist als PChar deklariert!
username := PChar(LoginName.Text);
query := 'SELECT * FROM lgm_users WEHRE Username=' + username + ''; Ich erhalte aber folgende Fehlermeldung: [Pascal Error] Unit1.pas(73): E2010 Incompatible types: 'string' and 'PAnsiChar' Die sich auf die Zeile "query := ..." bezieht! Könnt ihr mir helfen? Hoffe mal das war das richtige Forum! |
Re: E2010 Incompatible types: 'string' and 'PAnsiChar'
So sollte es gehen:
Delphi-Quellcode:
...wenn bei Datenbanken nicht irgendwas anders läuft, mit Datenbanken hab ich mich noch garnicht befasst.
username := PChar(LoginName.Text);
query := PAnsiChar('SELECT * FROM lgm_users WEHRE Username=' + username + ''); |
Re: E2010 Incompatible types: 'string' and 'PAnsiChar'
Danke funktioniert super!
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 22:10 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz