Recent

Author Topic: مشكلة في استعلام sql  (Read 344 times)

Gebo

  • New Member
  • *
  • Posts: 49
    • chahpander for lingeries
مشكلة في استعلام sql
« on: January 26, 2025, 02:10:26 pm »
أنا بنفذ بكون استعلام sql ولكن لا تأتي بسجل واحد
فما هو السبب
Code: Pascal  [Select][+][-]
  1.   SQLQuery1.Close;
  2.   ODBCConnection1.Close();
  3.   SQLQuery1.SQL.Text:='select weight,meter,lot,user,rolldate,colors.col_code,cloth.cloth_code from recorded_rolls inner join cloth on cloth.id=recorded_rolls.type_cloth inner join colors on colors.id=recorded_rolls.roll_color where ';
  4.  
  5.   if Trim(DBLookupComboBox1.Text) <> '' then
  6.     SQLQuery1.SQL.Add('recorded_rolls.roll_color ='+DBLookupComboBox1.KeyField+' and ');
  7.  
  8.   if Trim(DBLookupComboBox2.Text) <> '' then
  9.     SQLQuery1.SQL.Add('recorded_rolls.type_cloth= '+DBLookupComboBox2.KeyField+' and ');
  10.  
  11.   //فحص حقل الوزن وإضافته لكود sql
  12.   if Trim(Edit1.Text) <> '' then
  13.     SQLQuery1.SQL.Add('recorded_rolls.weight = '+Edit1.Text+' and ');
  14.  
  15.   //فحص حقل طول الرول وإضافته لكود sql
  16.   if Trim(Edit2.Text) <> '' then
  17.     SQLQuery1.SQL.Add('recorded_rolls.meter = '+Edit2.Text+' and ');
  18.  
  19.   SQLQuery1.SQL.Add('recorded_rolls.rolldate between '+DateToStr(DateTimePicker1.Date)+' and '+DateToStr(DateTimePicker2.Date)+' and ');
  20.   SQLQuery1.SQL.Add('1=1');
  21.   SQLQuery1.Open;
I like programming I begun by vb,vb.net,c# and finally free pascal and lazarus .I like martial arts sports and I am a kickboxer and made our team sport club called black eagle school I have a website for modern clothes..

nouzi

  • Moderator
  • Sr. Member
  • *****
  • Posts: 314
Re: مشكلة في استعلام sql
« Reply #1 on: January 26, 2025, 08:35:19 pm »
ماهي نتيجة الاستعلام عند تنفيده مباشرة على محرك قواعد المعطيات ؟
حول أستعمل FieldByName يكون الامر افضل
« Last Edit: January 26, 2025, 08:48:15 pm by nouzi »
My English is  bad
Lazarus last version free pascal last version
Lazarus trunk  free pascal trunk 
System : Linux mint  64bit  Windows 7 64bit

 

TinyPortal © 2005-2018