korasoglu Posted April 15, 2014 Share Posted April 15, 2014 Arkadaşlar nerede hata var anlamadım veri tabanına bağlanıyor yazdırırken hata varsa hatayı söylüyor bağlantıyı kes dedinmi hata veriyor yardımlarınızı bekliyorum. Global --------------------- sql = { baglan = function() SQLite3Connection, err = SQLite3:connect(_SourceFolder .. "\\veri.db", "", ""); end, kapat = function() db:close(); SQLite3Connection:close() end } kaydet ------------------------- if adi ~= "" and soyadi ~= "" and tel ~= "" then sql.baglan(); db, err = SQLite3Connection:execute("INSERT INTO kisiler (adi, soyadi, tel) VALUES ('" .. adi .. "', '" .. soyadi .. "', '" .. tel .. "',)") if not db and err then Dialog.Message("Hata", err) Application.ExitScript(); else sql.kapat(); DialogEx.Close(); end else Dialog.Message("Hata", "gerekli yerleri doldurunuz!", MB_OK, MB_ICONSTOP, MB_DEFBUTTON1) -- hata ver end Quote Link to comment Share on other sites More sharing options...
milano88 Posted April 15, 2014 Share Posted April 15, 2014 (edited) sSql = ""; if not tSql then tSql= {}; end tSql.Baglan = function (sSql) if (sSql == "") then sSql = _SourceFolder.."\\MyDataBase.db"; end SQLite3Connection, err = SQLite3:connect(sSql, "", ""); end tSql.Close = function() SQLite.Finalize(sSql); end Farkı bir örnek: if (Folder.DoesExist(_TempFolder)) then --- eğer temp klasörü pc de mevcut ise Folder.Create(_SourceFolder.."\\Database"); -- bir klasör oluşturuyoruz sDB = SQLite.Open(_SourceFolder.."\\Database\\MyDatabase.db"); -- veri tabanı dosyasını oluşturuyoruz SQLite.Query(sDB, "create table MyTable (id integer primary key, Path1 text, Path2 text)"); --isteğimize göre bir tablo oluşturuyoruz end local Path1 = "My Text"; local Path2 = "My Text"; SQLite.Query(sDB,"insert into MyTable values(NULL,'"..Path1.."', '"..Path2.."')"); -- değerleri tabloya depoluyoruz Veri tabanı bağlantısını kesmek için: SQLite.Finalize(sDB); collectgarbage(); Temp klasörünü kontrol etmemim sebebi bazen temp pc den silinebiliyor veya kaybolabiliyor temp yok ise sql çalışmaz hata verir geçici dosyaları oraya çıkardığı için örnek bu umarım faydalı olmuştur Edited April 17, 2014 by milano88 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.