![]() |
Clomosy Resmi Forum Sitesidir. Amacımız kullanıcılarımıza, iş ortaklarımıza, danışmanlara, yazılımcılara programlarımız hakkında destek ve bilgi vermektir. |
SQLite'a Data Yazdıramıyorum |
Yanıt Yaz ![]() |
Yazar | |
cerenn ![]() Yeni Üye ![]() Kayıt Tarihi: 18 Haziran 2025 Durum: Aktif Değil Puanlar: 4 |
![]() ![]() ![]() ![]() ![]() Gönderim Zamanı: 8 Saat 4 Dakika Önce Saat 16:27 |
var MyForm : TclForm; PListView1 : TClProListView; DesignerPanel1 : TClProListViewDesignerPanel; ad : TClProLabel; void SqLiteInsertData; { try Clomosy.DBSQLiteQuery.Sql.Text = ' INSERT INTO Kategoriler (id, ad) VALUES (1, ''Yemek''); INSERT INTO Kategoriler (id, ad ) VALUES (2, ''Kıyafet'');'; ShowMessage('Adding data to the table was successful!'); except ShowMessage('Exception Class: '+LastExceptionClassName+' Exception Message: '+LastExceptionMessage); } } void SqLiteConnectionCreateTable; var TableExists: Boolean; { try Clomosy.DBSQLiteConnect(Clomosy.AppFilesPath + 'DBProduct.db3', ''); // Check if the table exists Clomosy.DBSQLiteQuery.Sql.Text = 'SELECT name FROM sqlite_master WHERE type="table" AND name="Kategoriler";'; Clomosy.DBSQLiteQuery.OpenOrExecute; // Check the results TableExists = not Clomosy.DBSQLiteQuery.Eof; // Create the table if it does not exist if not (TableExists) { Clomosy.DBSQLiteQuery.Sql.Text = 'CREATE TABLE Kategoriler ( id INTEGER NOT NULL, ad TEXT NOT NULL, PRIMARY KEY (id) );'; Clomosy.DBSQLiteQuery.OpenOrExecute; ShowMessage('Table successfully added to the database!'); SqLiteInsertData; } else { ShowMessage('The Products table already exists.'); } except ShowMessage('Exception Class: '+LastExceptionClassName+' Exception Message: '+LastExceptionMessage); } } void GetData; var Qry : TClSQLiteQuery; { try Qry = Clomosy.DBSQLiteQueryWith('SELECT id as clRecord_GUID, ad from Kategoriler'); Qry.OpenOrExecute; if (Qry.Found) { PListView1.clLoadProListViewDataFromDataset(Qry); } except ShowMessage('Exception class: '+LastExceptionClassName+' Exception Message: ' +LastExceptionMessage); } } void CreateListView; { PListView1 = MyForm.AddNewProListView(MyForm,'PListView1'); PListView1.Properties.ItemSpace = 10; PListView1.Align = AlClient; PListView1.Margins.Bottom = 20; PListView1.Margins.Top = 20; PListView1.Margins.Right = 20; PListView1.Margins.Left = 20; PListView1.clProSettings.ColCount = 2; PListView1.clProSettings.ItemHeight = 150; PListView1.clProSettings.ItemWidth = 150; PListView1.clProSettings.BorderColor = clAlphaColor.clHexToColor('#F5BCC9'); PListView1.clProSettings.BorderWidth = 2; PListView1.clProSettings.RoundWidth = 5; PListView1.clProSettings.RoundHeight = 5; PListView1.clProSettings.ViewType = lvIcon; PListView1.SetclProSettings(PListView1.clProSettings); PListView1.ListType = 'horizontal'; } void CreateDesignerPanel; { DesignerPanel1 = MyForm.AddNewProListViewDesignerPanel(PListView1,'DesignerPanel1'); DesignerPanel1.Height = 100; DesignerPanel1.Width = 150; DesignerPanel1.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#F6EDDB'); DesignerPanel1.clProSettings.BorderColor = clAlphaColor.clHexToColor('#F5BCC9'); DesignerPanel1.clProSettings.BorderWidth = 2; DesignerPanel1.clProSettings.RoundWidth = 20; DesignerPanel1.clProSettings.RoundHeight = 20; DesignerPanel1.SetclProSettings(DesignerPanel1.clProSettings); PListView1.SetDesignerPanel(DesignerPanel1); } void CreateProductNameAndPrice; { ad = MyForm.AddNewProLabel(DesignerPanel1,'ad','test'); ad.Align = AlMostTop; ad.Height = 20; ad.Margins.Bottom = 10; ad.Margins.Top = 10; ad.Margins.Right = 10; ad.Margins.Left = 10; DesignerPanel1.AddPanelObject(ad,clCaption); ad.Properties.AutoSize = True; } { MyForm = TclForm.Create(Self); CreateListView; CreateDesignerPanel; SqLiteConnectionCreateTable; CreateProductNameAndPrice; GetData; MyForm.Run; } Merhaba, doküman sayfasında olan kodun yanlışlık yapmadıysam aynısını aldım.Tek fark tablomun adı ve içeriği.Data eklendi mesajını alıyorum ama table oluşturulsa dahi datalar ısrarla eklenmiyor.Sebebi nedir acaba?
|
|
![]() |
|
Emr.Erkmn ![]() Moderatör ![]() Kayıt Tarihi: 28 Şubat 2025 Durum: Aktif Değil Puanlar: 79 |
![]() Yanıt Yaz
Alıntı Emr.Erkmn
Bu mesaj kurallara aykırıysa buradan yöneticileri bilgilendirebilirsiniz.
![]() ![]() ![]() ![]() |
Merhaba Ceren, Kodu incelediğimde herhangi bir hata görünmüyor. Bende sorunsuz şekilde çalıştı. Proje klasöründeki mevcut |
|
![]() |
Yanıt Yaz ![]() |
|
Tweet |
Forum Atla | Forum İzinleri ![]() Kapalı Foruma Yeni Konu Gönderme Kapalı Forumdaki Konulara Cevap Yazma Kapalı Forumda Cevapları Silme Kapalı Forumdaki Cevapları Düzenleme Kapalı Forumda Anket Açma Kapalı Forumda Anketlerde Oy Kullanma |