muratboy31 Posted July 22, 2013 Share Posted July 22, 2013 Merhaba arkadaşlar, Gridde seçilen veri tabanından silsin istiyorum ama tüm veri tabanını siliyor nedendir acaba? function FindSelectedGrid(strGrid)tblSelect ={};nRows = Grid.GetRowCount(strGrid)-1;nColumns = Grid.GetColumnCount(strGrid)-1; local x= 0; while (x<(nRows)) do x = x+1; for count = 1,nColumns do if (Grid.IsCellSelected(strGrid, x, count))== true then tblSelect.Row = x; end end end local n = 0; while (n<nColumns) do n = n+1; for count = 1,nRows do if (Grid.IsCellSelected(strGrid, count, n))== true then tblSelect.Column = n; end end end return tblSelect end selected = FindSelectedGrid("Grid1")if selected ~= nil thenresult = Grid.GetCellText("Grid1", selected.Row, 8);SQLite3Cursor, err = SQLite3Connection:execute("delete from cihazlar where id="..result.."");Dialog.Message("Başarılı", "Kayıt silindi." , MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);---------------------------------SQLite3Cursor, err = SQLite3Connection:execute("SELECT * FROM cihazlar");goster = SQLite3Cursor:fetch({},"a")a = 1; while goster do Grid.SetRowCount("Grid1", a + 1); Grid.SetCellText("Grid1", a, 1, goster.adi, true); Grid.SetCellText("Grid1", a, 2, goster.soyadi, true); Grid.SetCellText("Grid1", a, 3, goster.cihaz, true); Grid.SetCellText("Grid1", a, 4, goster.marka, true); Grid.SetCellText("Grid1", a, 5, goster.model, true); Grid.SetCellText("Grid1", a, 6, goster.tarih, true); Grid.SetCellText("Grid1", a, 7, goster.seri, true); Grid.SetCellText("Grid1", a, 8, goster.id, true); goster = SQLite3Cursor:fetch(goster,"a"); a = a+1;-- Grid.SetRowCount("Grid1", a);end Grid.Refresh("Grid1");---------------------------------elseDialog.Message(" Seçim yapılmadı ! ");end Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted July 22, 2013 Editor Share Posted July 22, 2013 Gridden dönen ID doğrumu Quote Link to comment Share on other sites More sharing options...
muratboy31 Posted July 22, 2013 Author Share Posted July 22, 2013 Çalıştığım dosyayı ekledim, ayrıca Seri No'dan silecek şekilde ayarladım ama silme işlemini gerçekleştiremedim. http://tr.rghost.net/47587520 Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted July 22, 2013 Editor Share Posted July 22, 2013 SQLite3Cursor, err = SQLite3Connection:execute("delete from cihazlar where seri='"..result.."'"); kodu bununla değiştir düzelecketir. Quote Link to comment Share on other sites More sharing options...
muratboy31 Posted July 22, 2013 Author Share Posted July 22, 2013 Teşekürler yalnız şöyşe bir sorun var, son veri silindiğinde refresh olmuyor grid ! Teşekürler yalnız şöyşe bir sorun var, son veri silindiğinde refresh olmuyor grid ! Quote Link to comment Share on other sites More sharing options...
Sistemci Posted July 22, 2013 Share Posted July 22, 2013 function FindSelectedGrid(strGrid) tblSelect ={}; nRows = Grid.GetRowCount(strGrid)-1; nColumns = Grid.GetColumnCount(strGrid)-1; local x= 0; while (x<(nRows)) do x = x+1; for count = 1,nColumns do if (Grid.IsCellSelected(strGrid, x, count))== true then tblSelect.Row = x; end end end local n = 0; while (n<nColumns) do n = n+1; for count = 1,nRows do if (Grid.IsCellSelected(strGrid, count, n))== true then tblSelect.Column = n; end end end return tblSelect end selected = FindSelectedGrid("Grid1") if selected ~= nil then result = Grid.GetCellText("Grid1", selected.Row, 7); SQLite3Cursor, err = SQLite3Connection:execute("delete from cihazlar where seri='"..result.."'"); Dialog.Message("Başarılı", "Kayıt silindi." , MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1); --------------------------------- SQLite3Cursor, err = SQLite3Connection:execute("SELECT * FROM cihazlar"); goster = SQLite3Cursor:fetch({},"a") a = 1; while goster do Grid.SetRowCount("Grid1", a + 1); Grid.SetCellText("Grid1", a, 1, goster.adi, true); Grid.SetCellText("Grid1", a, 2, goster.soyadi, true); Grid.SetCellText("Grid1", a, 3, goster.cihaz, true); Grid.SetCellText("Grid1", a, 4, goster.marka, true); Grid.SetCellText("Grid1", a, 5, goster.model, true); Grid.SetCellText("Grid1", a, 6, goster.tarih, true); Grid.SetCellText("Grid1", a, 7, goster.seri, true); -- Grid.SetCellText("Grid1", a, 8, goster.id, true); Grid.Refresh("Grid1"); goster = SQLite3Cursor:fetch(goster,"a"); a = a+1; -- Grid.SetRowCount("Grid1", a); end Grid.Refresh("Grid1"); --------------------------------- else Dialog.Message(" Seçim yapılmadı ! "); end bunu sil butonuna yapıştır kardeşim Quote Link to comment Share on other sites More sharing options...
muratboy31 Posted July 22, 2013 Author Share Posted July 22, 2013 Sistemci cevap için teşekürler fakat halen son veri silindikten sonra gridden gitmiyor, yane veri tabaınındaki son veriyi silince gridde kalıyor Quote Link to comment Share on other sites More sharing options...
TuTaMixx Posted July 22, 2013 Share Posted July 22, 2013 (edited) Page.Jump("Page1"); --> (Page1 yazan yeri kendi sayfanın adıyla değiştir zaten Page1 ise değiştirmene gerek yok.) Sonuna bu kodu ekleyebilir misin ? Else'den önce. Edited July 22, 2013 by TuTaMixx Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted July 22, 2013 Editor Share Posted July 22, 2013 Ben senin verdiğin projede sildim gayette güzel refresh etti :D Quote Link to comment Share on other sites More sharing options...
Sistemci Posted July 22, 2013 Share Posted July 22, 2013 bende de gayet hoş çalışıyor :D Quote Link to comment Share on other sites More sharing options...
muratboy31 Posted July 22, 2013 Author Share Posted July 22, 2013 Sadece son kalan öğe silinmiyor, diğerleri zaten gidiyor !!! ayrıca ekleme de şunu yapmak istiyorum eğer seri no aynı olan başka bir kayıt varsa kaydetmesin... şunu denedim ama olmadı ; SQLite3Cursor, err = SQLite3Connection:execute("SELECT * FROM cihazlar");goster = SQLite3Cursor:fetch({},seri) if seri == goster thenDialog.Message("Uyarı", "Bu Seri No Daha Önceden Kayıt Edilmiş !", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);elseSQLite3Connection:execute("insert into cihazlar values(NULL,'"..adi.."','"..soyadi.."','"..cihaz.."','"..marka.."','"..model.."','"..tarih.."','"..seri.."') ");end Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted July 22, 2013 Editor Share Posted July 22, 2013 select from ile çektiğin de where serino = seri şeklinde kullanki deger varsa gelsin yoksa boş dönsün. Quote Link to comment Share on other sites More sharing options...
muratboy31 Posted July 22, 2013 Author Share Posted July 22, 2013 Bu şekilde denedim fakat sonuç aynı... seri = Input.GetText("Input3"); SQLite3Cursor, err = SQLite3Connection:execute("SELECT * FROM cihazlar where seri"); goster = SQLite3Cursor:fetch({},seri) if seri == goster then Dialog.Message("Uyarı", "Bu Seri No Daha Önceden Kayıt Edilmiş !", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1); else SQLite3Connection:execute("insert into cihazlar values(NULL,'"..adi.."','"..soyadi.."','"..cihaz.."','"..marka.."','"..model.."','"..tarih.."','"..seri.."') "); Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted July 22, 2013 Editor Share Posted July 22, 2013 SQLite3Cursor, err = SQLite3Connection:execute("SELECT * FROM cihazlar where seri"); bu şekilde olmaz.galetisin sql derslerini izlemediniz sanırım. SQLite3Cursor, err = SQLite3Connection:execute("SELECT * FROM cihazlar where serino = seri"); Quote Link to comment Share on other sites More sharing options...
muratboy31 Posted July 22, 2013 Author Share Posted July 22, 2013 Teşekürler cevap için pairs yalnız ben iki şeyi merak ettim ; seri = Input.GetText("Input3"); SQLite3Cursor, err = SQLite3Connection:execute("SELECT * FROM cihazlar where serino = seri"); 1- kırmızı ile işaretlediğin serino nerden geldi ? 2- lacivert ile işaretli seri input seri mi yoksa veri tabanındaki seri mi ? bu şekilde çalışmadı... Quote Link to comment Share on other sites More sharing options...
galetis Posted July 22, 2013 Share Posted July 22, 2013 Teşekürler cevap için pairs yalnız ben iki şeyi merak ettim ; seri = Input.GetText("Input3"); SQLite3Cursor, err = SQLite3Connection:execute("SELECT * FROM cihazlar where serino = seri"); 1- kırmızı ile işaretlediğin serino nerden geldi ? 2- lacivert ile işaretli seri input seri mi yoksa veri tabanındaki seri mi ? bu şekilde çalışmadı... serino senin sütununun adıdır, yani veritabanındaki alanının adı. seri ise, o sütuna hangi değerin geleceğidir. Yani Select * From cihazlar Where serino=4 dersen, serino'su 4 olan cihazı getirecektir. Bu 4 değişkenini başka yerden almak içinde SQLite3Cursor, err = SQLite3Connection:execute("SELECT * FROM cihazlar where serino = " .. seri); kodunu kullanman yeterli olacaktır. Quote Link to comment Share on other sites More sharing options...
muratboy31 Posted July 22, 2013 Author Share Posted July 22, 2013 ben halen bu serino nun nerden geldiğini bulamadım ! tablom bu şekilde Bu şekilde denedim ama yine olmadı, benmi birşeyi atlıyorum ? seri = Input.GetText("Input3"); SQLite3Cursor, err = SQLite3Connection:execute("SELECT * FROM cihazlar where seri ="..seri); goster = SQLite3Cursor:fetch(seri) if seri == goster then Dialog.Message("Uyarı", "Bu Seri No Daha Önceden Kayıt Edilmiş !", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1); else SQLite3Connection:execute("insert into cihazlar values(NULL,'"..adi.."','"..soyadi.."','"..cihaz.."','"..marka.."','"..model.."','"..tarih.."','"..seri.."') "); Quote Link to comment Share on other sites More sharing options...
galetis Posted July 22, 2013 Share Posted July 22, 2013 serino'yu sütun olarak anladım ben. Bu şekilde ise, SQLite3Cursor, err = SQLite3Connection:execute("SELECT * FROM cihazlar where seri ='" .. seri .. "'"); olarak kullanman gerekir. Quote Link to comment Share on other sites More sharing options...
muratboy31 Posted July 23, 2013 Author Share Posted July 23, 2013 Yine olmadı bir yanlışlık mı var acaba aşağıdaki kodda ? adi = Input.GetText("Input1"); soyadi = Input.GetText("Input2"); cihaz = ComboBox.GetText("ComboBox1"); marka = Input.GetText("Input4"); model = Input.GetText("Input5"); tarih = DateTimePicker.GetDateTimeStr("Plugin1"); seri = Input.GetText("Input3"); SQLite3Cursor, err = SQLite3Connection:execute("SELECT * FROM cihazlar where seri ='" .. seri .. "'"); goster = SQLite3Cursor:fetch(seri) if seri == goster then Dialog.Message("Uyarı", "Bu Seri No Daha Önceden Kayıt Edilmiş !", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1); else SQLite3Connection:execute("insert into cihazlar values(NULL,'"..adi.."','"..soyadi.."','"..cihaz.."','"..marka.."','"..model.."','"..tarih.."','"..seri.."') "); SQLite3Cursor, err = SQLite3Connection:execute("SELECT * FROM cihazlar where seri ='"..seri.."'"); goster = SQLite3Cursor:fetch({},"a") a = 1; while goster do Grid.SetRowCount("Grid1", a + 1); Grid.SetCellText("Grid1", a, 1, goster.adi, true); Grid.SetCellText("Grid1", a, 2, goster.soyadi, true); Grid.SetCellText("Grid1", a, 3, goster.cihaz, true); Grid.SetCellText("Grid1", a, 4, goster.marka, true); Grid.SetCellText("Grid1", a, 5, goster.model, true); Grid.SetCellText("Grid1", a, 6, goster.tarih, true); Grid.SetCellText("Grid1", a, 7, goster.seri, true); goster = SQLite3Cursor:fetch(goster, "a"); a = a+1; end Grid.Refresh("Grid1"); Dialog.Message("Urun Bilgisi","Kullanan : "..adi.."\n\r\n Cihaz : " ..cihaz.."eklendi."); end Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted July 23, 2013 Editor Share Posted July 23, 2013 if seri == goster then bu şekilde değilde if seri == goster.seri then şeklinde yapacaksın.Ayrıca goster = SQLite3Cursor:fetch(seri) bunuda goster = SQLite3Cursor:fetch({},"a") bu şekilde yaparsınz. Quote Link to comment Share on other sites More sharing options...
muratboy31 Posted July 23, 2013 Author Share Posted July 23, 2013 Teşekürler pairs o sorun çözüldü fakat şimdide kayıt etmiyor ! Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted July 23, 2013 Editor Share Posted July 23, 2013 goster = SQLite3Cursor:fetch({},"a") bunu table değilde şu şekilde yaparmısın.Gözümden kaçmış. goster = SQLite3Cursor:fetch(); Quote Link to comment Share on other sites More sharing options...
muratboy31 Posted July 23, 2013 Author Share Posted July 23, 2013 Sanırım ben yanlış birşeyler yapıyorum, lütfen projeye bakabilirmisin ? http://tr.rghost.net/47606432 Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted July 23, 2013 Editor Share Posted July 23, 2013 kodları bunlarla değiştir. http://goo.gl/rfALzL Quote Link to comment Share on other sites More sharing options...
muratboy31 Posted July 23, 2013 Author Share Posted July 23, 2013 Teşekürler pairs Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.