kayıt yaparken hata nerdedir ??

Delphi .net ve .net ile ilgili konuları buraya yazabilirsiniz.
Cevapla
Kullanıcı avatarı
calvan
Üye
Mesajlar: 119
Kayıt: 16 Haz 2003 05:10

kayıt yaparken hata nerdedir ??

Mesaj gönderen calvan »

ekranda 3 tane text box ve 1 tane buton var, aşağıdaki hatayı verme sebebi ne olabilir

teşekkürler

procedure TWebForm1.Button1_Click(sender: System.Object; e: System.EventArgs);
var
komut : oleDBCommand;
baglanti : oleDbConnection;
begin
baglanti := oleDBConnection.Create('Provider = SQLOLEDB.1;'+'Integrated Security=SSPI;'+
'Initial Catalog=Ajanda;'+'Data Source=ELVAN');
komut := oleDBCommand.Create;
komut.Connection := baglanti;
komut.CommandText := 'INSERT INTO Ajanda(Isim,Soyisim,EvTelefon)'+
'VALUES("'+TextAdi.Text+'","'+TextSoyisim.Text+'","'+TextEvTelefonu.Text+'")';

try
baglanti.open;
komut.ExecuteNonQuery;
finally
baglanti.Close;
end;

end;

qqq ilk textbox a girdiğim değer

(

Server Error in '/Ajanda' Application.
--------------------------------------------------------------------------------

The name 'qqq' is not permitted in this context. Only constants, expressions, or variables allowed here. Column names are not permitted.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: The name 'qqq' is not permitted in this context. Only constants, expressions, or variables allowed here. Column names are not permitted.

Source Error:


Line 103: try
Line 104: baglanti.open;
Line 105: komut.ExecuteNonQuery;
Line 106: finally
Line 107: baglanti.Close;


Source File: c:\inetpub\wwwroot\Ajanda\WebForm1.pas Line: 105
Kullanıcı avatarı
lazio
Moderator
Mesajlar: 1527
Kayıt: 11 Tem 2003 04:55
Konum: İstanbul

Mesaj gönderen lazio »

text ler için TextAdi.Text.ToString şeklinde denermisiniz..
DeveloperToolKit

..::|YeşilMavi|::..
Kullanıcı avatarı
calvan
Üye
Mesajlar: 119
Kayıt: 16 Haz 2003 05:10

Mesaj gönderen calvan »

bişey değişmedi, aynı hatayı veriyor

öncesinde butona tıklayınca

Project //localhost/Ajanda/WebForm1.aspx raised ecxeption class System.Data.OleDb.OleDbException

break Continue Help

hatası veriyor

kodda farkettiğiniz bir hata var mı
Kullanıcı avatarı
lazio
Moderator
Mesajlar: 1527
Kayıt: 11 Tem 2003 04:55
Konum: İstanbul

Mesaj gönderen lazio »

CommandText e verdiğin string i kontrol et hocam..
bu sql i ekrana yazdırarak, kullandığın database in sql editöründe çalıştırmayı dene. sanırım sql kodunda syntax hatası var..

[/code]
DeveloperToolKit

..::|YeşilMavi|::..
Kullanıcı avatarı
calvan
Üye
Mesajlar: 119
Kayıt: 16 Haz 2003 05:10

Mesaj gönderen calvan »

komut.CommandText := 'INSERT INTO Ajanda (Isim,Soyisim,EvTelefon) VALUES ('+#39+TextAdi.Text+#39+','+#39+TextSoyisim.Text+#39+','+#39+TextEvTelefonu.Text+#39')';

şeklinde yazınca kaydetti,

teşekkürler
Cevapla