Jump to content

Treelist(Plugin) Veritabanından Veri Silme


prototype
 Share

Recommended Posts

Arkadaşlar TreeList(Plugin)'den seçilen veriyi veritabanından silmek istiyorum ancak aşağıdaki hatayı alıyorum;

[center][img]http://img201.imageshack.us/img201/1206/hataaj.png[/img][/center]

Hatada gösterilen butonun kodları

[code]
secilen = TreeList.GetSelected("liste");
id = TreeList.GetRowData("liste", secilen[1]);
SQLite3Connection, err = SQLite3:connect("C:\\database.db");
SQLite3Cursor, err = SQLite3Connection:execute("delete from siteler where id="..id.."");
Dialog.TimedMessage("Dikkat !", "Site silindi !", 1500, MB_ICONINFORMATION);
[/code]

Hatayı verdiği satır 2 yani;

[code]id = TreeList.GetRowData("liste", secilen[1]);[/code]

burada ne gibi bir hata yapmış olabilirim. Treelist(plugin) konusunda yeniyim ve acemeyim. Yardımlarınızı bekliyorum :(.

Link to comment
Share on other sites

SQL kısmında sıkıntı vardır o zaman, o konuda bilgim yok. Ama şöyle birşey dene ;

[codebox]
secilen = TreeList.GetSelected("liste");
id = TreeList.GetRowData("liste", secilen);
SQLite3Connection, err = SQLite3:connect("C:\\database.db");
SQLite3Cursor, err = SQLite3Connection:execute("delete from siteler where id="..id);
Dialog.TimedMessage("Dikkat !", "Site silindi !", 1500, MB_ICONINFORMATION);
[/codebox]

O da olmazsa rowdata belki boş dönüyordur. Onu da labelle veya dialog.message ile falan bi test et.

Edited by DivaneTR
Link to comment
Share on other sites

Silme işlemini neden yapmadığını çözebildim.

Hata bu kodda mevcut;
[code]secilen = TreeList.GetSelected("liste");
id = TreeList.GetRowData("liste", secilen[1]);[/code]

Burada kullanılan kodlarla seçilen verinin sayısal değerini alamadığını için veritabanından silmiyor.

Ancak sadece silme kodunu kullanıp sayısal değerini elle girince siliyor.

[code]SQLite3Connection, err = SQLite3:connect("C:\\database.db");
SQLite3Cursor, err = SQLite3Connection:execute("delete from siteler where id="..id);
Dialog.TimedMessage("Dikkat !", "Site silindi !", 1500, MB_ICONINFORMATION);[/code]

Şuan sorun seçilen verinin sayısal değerini alabilirsek (ki ben beceremedim) giderilmiş olacak.

Edited by prototype
Link to comment
Share on other sites

Şunu Globale yaz
Bak = "";
Birde şu satıra iyi bak tablo ismi doğru olsun ("DELETE FROM kayit (parantez dahil yok Bende tablonun adı kayit seninki ne ise onu yazacaksın )WHERE id='" .. Bak .. "'");


liste = TreeList.GetSelected("Plugin1");
isa = TreeList.GetCellText("Plugin1", liste, 1);
if isa == "" then
Audio.Load(CHANNEL_NARRATION, "AutoPlay\\Audio\\Hata.wav", true, false);
result = Dialog.Message("Selam", "Silinecek kaydı seçmediniz", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
Page.Jump("Anasayfa")
else
end
local nRow = TreeList.GetSelected("Plugin1")
if nRow ~= -1 then
local Sorunyok = TreeList.GetCellText("Plugin1", nRow, 2)
if Sorunyok ~= "" then


Bak = TreeList.GetCellText("Plugin1", nRow, 0)
Bak = String.ToNumber(Bak)
Veri = TreeList.GetCellText("Plugin1", nRow, 1)
Mesaj = Dialog.Message("Selam", Veri .. " adlı kişiyi silmek istiyor musunuz?", MB_YESNO, MB_ICONEXCLAMATION, MB_DEFBUTTON1)
if Mesaj == IDYES then
SQLite3Cursor, err = SQLite3Connection:execute("DELETE FROM kayit WHERE id='" .. Bak .. "'");
if not SQLite3Cursor and err then
Dialog.Message("hata", err)
else
Page.Jump("AnaSayfa")
end
end
end
end

Link to comment
Share on other sites

PM ile gelen projede şu şekilde düzeltmeler yapıldı:

[u]DialogEx On Show:[/u]

[codebox]result = TreeList.AddColumn("liste", "Site Adı", 200);
result = TreeList.AddColumn("liste", "Site Adresi", 200);
result = TreeList.AddColumn("liste", "Kullanıcı Adı", 200);
result = TreeList.AddColumn("liste", "Şifre", 195);

SQLite3Connection, err = SQLite3:connect("Data\\database.db");
SQLite3Cursor, err = SQLite3Connection:execute("SELECT * FROM siteler");
satir = SQLite3Cursor:fetch({},"a");
while satir do
result = TreeList.AddRow("liste", satir.siteadi.. "|"..satir.siteadresi.."|"..satir.kullaniciadi.."|"..satir.sifre, nil, nil, satir.id);
satir = SQLite3Cursor:fetch(satir,"a");
end[/codebox]

[u]DialogEx'teki Sil buttonu On Click evresi:[/u]

[codebox]nCount = TreeList.CountRows("liste")
if nCount ~= 0 then
SeciliSayisi = 0;
for i=0,nCount-1 do
bSecili = TreeList.GetRowChecked("liste", i)
if bSecili then
SeciliSayisi = 1
nID = TreeList.GetRowData("liste", i)
SQLite3Connection, err = SQLite3:connect("Data\\database.db");
SQLite3Cursor, err = SQLite3Connection:execute("delete from siteler where id="..nID.."");
end
end
if SeciliSayisi ~= 0 then
Dialog.TimedMessage("Dikkat !", "Seçili siteler silindi !", 1500, MB_ICONINFORMATION);
TreeList.ClearRows("liste")
SQLite3Connection, err = SQLite3:connect("Data\\database.db");
SQLite3Cursor, err = SQLite3Connection:execute("SELECT * FROM siteler");
satir = SQLite3Cursor:fetch({},"a");
while satir do
result = TreeList.AddRow("liste", satir.siteadi.. "|"..satir.siteadresi.."|"..satir.kullaniciadi.."|"..satir.sifre, nil, nil, satir.id);
satir = SQLite3Cursor:fetch(satir,"a");
end
else
Dialog.TimedMessage("Dikkat !", "Önce seçim yapın!", 1500, MB_ICONEXCLAMATION);
end
end
[/codebox]

Link to comment
Share on other sites

Sağol üstad ancak bir problemim daha var :(

Veritabanından düzenleme işleminde hata alıyorum :(..

[left][img]http://www.fileden.com/files/2012/6/29/3321548//hata.png[/img][/left]

Müşteri Düzenle sayfasındaki On Show sekmesinde bulunan kodlar;
[code]
SQLite3Connection, err = SQLite3:connect("Database\\database.db", "", "")
SQLite3Cursor, err = SQLite3Connection:execute("SELECT * FROM musteriler WHERE id='" .. sKayitID .. "'")
if SQLite3Cursor ~= nil then
tVeriler = SQLite3Cursor:fetch({},"a");
Input.SetText("adi", tVeriler.adi)
Input.SetText("soyadi", tVeriler.soyadi)
Input.SetText("mevkisi", tVeriler.mevkisi)
Input.SetText("risklimiti", tVeriler.risklimiti)
Input.SetText("telefonu", tVeriler.telefonu)
Input.SetText("ceptelefonu", tVeriler.ceptelefonu)
Input.SetText("vergidairesi", tVeriler.vergidairesi)
Input.SetText("vergino", tVeriler.vergino)
end
[/code]

Müşteri Düzenle butonundaki kodlar;

[code]
nRow = TreeList.GetSelected("musterilistesi")
if nRow ~= -1 then
sKayitID = TreeList.GetCellText("musterilistesi", nRow, 0)
sKayitID = String.ToNumber(sKayitID)
sKayitID = sKayitID-100
DialogEx.Show("musteriduzenle")
end
[/code]

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...