Sayfayı Yazdır | Pencereyi Kapat

Access violation at adress 0087D01C in module

Nereden Yazdırıldığı: Clomosy | Forum
Kategori: Genel Programlama
Forum Adı: Genel İşlemler
Forum Tanımlaması: TRObject dili ile programlama yaparken karşılaşılan genel işlemler
URL: https://forum.clomosy.com.tr/forum_posts.asp?TID=676
Tarih: 06 Ocak 2025 Saat 18:28
Program Versiyonu: Web Wiz Forums 12.07 - https://www.webwizforums.com


Konu: Access violation at adress 0087D01C in module
Mesajı Yazan: iremNisak
Konu: Access violation at adress 0087D01C in module
Mesaj Tarihi: 16 Temmuz 2024 Saat 11:26
var
  form: TCLForm;
  durum:TCLUnit;
  girdi,hosgeldiniz:TClProLabel;
  gidis:TClProButton;
  list:TCLProListView;
  DesignerPanel : TClProListViewDesignerPanel;
  EMPLOYEE_NAME,EMPLOYEE_ID,JOB_TITLE,EMPLOYEE_SURNAME : TClProLabel;
  query:TClSqlQuery;
  status:String;
  
  void GoToUnit1;
{
  form.clShow;
  durum.UnitName = 'durum';
  durum.CallerForm = form;
  durum.Run;
}
void SetupSqlConnection;
 {
   Clomosy.DBSQLServerConnect('SQL Server','172.16.222.156','sa','irem1234','vardiyaa',50000);
 }
void AddDataToListview;

 {
   query = TClSqlQuery.Create(nil);
   try
     query.Connection = Clomosy.DBSQLServerConnection;
     query.sql.text=  'SELECT ' +
                      'kisi_id AS EMPLOYEE_ID, ' +
                      'kisi_adi AS EMPLOYEE_NAME, ' +
                      'kisi_soyad AS EMPLOYEE_SURNAME, ' +
                      'kisi_meslegi AS JOB_TITLE, ' +
                      'vardiya_baslangic AS SHIFT_START, ' +
                      'vardiya_bitis AS SHIFT_END, ' +
                      'dinlenme_bas AS REST_START, ' +
                      'dinlenme_bitis AS REST_END, ' +
                      'CASE ' +
                      'WHEN CAST(GETDATE() AS TIME) BETWEEN vardiya_baslangic AND vardiya_bitis THEN ''Çalışıyor'' ' +
                      'WHEN CAST(GETDATE() AS TIME) BETWEEN dinlenme_bas AND dinlenme_bitis THEN ''Dinleniyor'' ' +
                      'ELSE ''Müsait'' ' +
                      'END AS Durum ' +
                      'FROM vardiyaa';
    query.Open;
     if (query.Found)
     {
       list.clLoadProListViewDataFromDataset(query);
     }
     
   except
    ShowMessage('Exception Class: '+LastExceptionClassName+' Exception Message: '+LastExceptionMessage);
     query.Free;
   }
   }

   void CreateDesignerPanel;
 {
   DesignerPanel = form.AddNewProListViewDesignerPanel(list,'DesignerPanel'); 
   clComponent.SetupComponent(DesignerPanel,'{"Height":250,"Width" : 150,"BackgroundColor":"#F6EDDB","BorderColor":"#F5BCC9","BorderWidth":2,"RoundHeight":20,"RoundWidth":20}');
   list.SetDesignerPanel(DesignerPanel);
 }
 
 void CreateListView;
 {
   list = form.AddNewProListView(form,'list');
   list.Properties.ItemSpace = 10;
   clComponent.SetupComponent(list,'{"Height" : 150,"Align":"Client","MarginBottom":20,"MarginTop":20,"MarginRight":10,"MarginLeft":10, "ListType":"Cart","ItemColumnCount" : 2,"ItemHeight" : 160,"ItemWidth":160, 
   "BorderColor":"#F5BCC9", "BorderWidth":2,"RoundWidth":5, "RoundHeight":5}');
   list.ListType = 'horizontal';
   form.AddNewEvent(list,tbeOnItemClick,'onItemClicked');
 }
 void onItemClicked;
 {
  
   query.Open;
      //ShowMessage(query.FieldByName('Durum').AsString);
      
      if (query.found)
      {
        status = query.FieldByName('Durum').AsString;
        hosgeldiniz.Caption='Durum: '+status;
        if(status=='Müsait')
        {
          form.SetFormColor('#66b76c ', '', clGNone);
        }
        else{
          form.SetFormColor('#f57a99', '', clGNone);
        }
        }
      
      else
      {
        hosgeldiniz.Caption='Kişi bulunamadı';
    }
    query.Free;
 }

void CreateEMPLOYEE_NAMEAndPrice;
 {
   EMPLOYEE_ID = form.AddNewProLabel(DesignerPanel,'EMPLOYEE_ID','test');
   clComponent.SetupComponent(EMPLOYEE_ID,'{"MarginTop":5,"MarginLeft":10,"MarginRight":0,"MarginBottom":0 ,"Height":20,"Width":10,"Align" : "MostTop"}');
   DesignerPanel.AddPanelObject(EMPLOYEE_ID,clCaption);
   EMPLOYEE_ID.Properties.AutoSize = True;
   
   EMPLOYEE_NAME = form.AddNewProLabel(DesignerPanel,'EMPLOYEE_NAME','test');
   clComponent.SetupComponent(EMPLOYEE_NAME,'{"MarginTop":5,"MarginLeft":10,"MarginRight":0,"MarginBottom":0 ,"Height":20,"Align" : "Mosttop"}');
   DesignerPanel.AddPanelObject(EMPLOYEE_NAME,clText);
   EMPLOYEE_NAME.Properties.AutoSize = True;
   
   EMPLOYEE_SURNAME = form.AddNewProLabel(DesignerPanel,'EMPLOYEE_SURNAME','test');
   clComponent.SetupComponent(EMPLOYEE_SURNAME,'{"MarginTop":5,"MarginLeft":10,"MarginRight":0,"MarginBottom":0 ,"Height":20,"Align" : "Mosttop"}');
   DesignerPanel.AddPanelObject(EMPLOYEE_SURNAME,clText1);
   EMPLOYEE_SURNAME.Properties.AutoSize = True;
   
   JOB_TITLE= form.AddNewProLabel(DesignerPanel,'JOB_TITLE','test');
   clComponent.SetupComponent(JOB_TITLE,'{"MarginTop":5,"MarginLeft":10,"MarginRight":0,"MarginBottom":0 ,"Height":20,"Align" : "Mosttop"}');
   DesignerPanel.AddPanelObject(JOB_TITLE,clText2);
   JOB_TITLE.Properties.AutoSize = True;
   
 }

{
  form = TCLForm.Create(self);
  form.SetFormColor('#b387e8', '', clGNone);
  durum = TclUnit.Create;
  
  CreateListView;
  SetupSqlConnection;
   CreateDesignerPanel;
   CreateEMPLOYEE_NAMEAndPrice;
   AddDataToListview;
   
  hosgeldiniz = form.AddNewproLabel(form, 'hosgeldiniz', 'Vardiya Uygulamamıza Hoşgeldiniz');
  clComponent.setupComponent(hosgeldiniz,
  '{
    "Align":"top","MarginsTop":70,"MarginsLeft":80,"MarginsRight":80,"Width":80,"Height":80,
    "TextColor":"#ad0154","TextSize":30,"TextVerticalAlign":"center",
    "TextHorizontalAlign":"center","TextBold":"yes"
  }');

 girdi = form.AddNewproLabel(form, 'girdi', 'Kişi Bilgilerini Değiştirmek İçin Tıklayınız');
  clComponent.setupComponent(girdi,
  '{
   "Align":"bottom","TextColor":"#ad0154","TextSize":20,"MarginsBottom":80,"Height":50,"MarginsLeft":50
  }');


  gidis = form.AddNewProButton(form, 'gidis', 'TIKLAYINIZ');
  clComponent.setupComponent(gidis,
  '{
    "Align":"Mostbottom","Width":20,"Height":80,"MarginsTop":50,"MarginsBottom":20,
    "TextColor":"#c7237b","TextSize":25,"RoundHeight":250,"RoundWidth":250,
    "BorderColor":"#7A3E65","TextBold":"yes","BorderWidth":5
  }');
  
  form.AddNewEvent(gidis, tbeOnClick, 'GoToUnit1');

 /* try
  Clomosy.DBSQLServerConnect('SQL Server', 'IREM\SQLEXPRESS', 'sa', 'irem1234', 'vardiyaa', 1433);
  except
     ShowMessage('Exception Class: '+LastExceptionClassName+' Exception Message: '+LastExceptionMessage);
  }*/
  form.Run;

  }



Cevaplar:
Mesajı Yazan: iremNisak
Mesaj Tarihi: 16 Temmuz 2024 Saat 11:27
Liste üzerindekindelere 2 kere basılmıyor


Mesajı Yazan: Developer
Mesaj Tarihi: 16 Temmuz 2024 Saat 11:51
Merhaba İrem,
onItemClicked prosedüründe 
testListview.clSelectedItemData('MAIN_TEXT'); 
bu şekilde tıklanan elemanın değerini öğrenebiliyorsun. Daha sonra sql den bu elemanın durumunu sorgulaman gerekiyor. 
SELECT DURUM FROM TABLO WHERE FIELD = testListview.clSelectedItemData('MAIN_TEXT')
buradan gelen değeri okursun.



Sayfayı Yazdır | Pencereyi Kapat

Forum Software by Web Wiz Forums® version 12.07 - https://www.webwizforums.com
Copyright ©2001-2024 Web Wiz Ltd. - https://www.webwiz.net