5,476

(9 replies, posted in General)

radsoft
Sorry for delay.


Here you can find info about row locking in the MySQL
http://www.xpertdeveloper.com/2011/11/r … ith-mysql/

5,477

(9 replies, posted in General)

1. Yes.


2. Do you mean using WebGrid (beta version 2.4) ?
Besides MySQL server you should have installed PHP and Apache.


Here you can find ready to use Windows server, which include Apache, MySQL and PHP:
http://www.uniformserver.com/
http://www.uwamp.com/en/

5,478

(9 replies, posted in General)

For developing you can use a root account, but when your project will use some users, I recommend to create another MySQL account without permission to change database structure.


If your MySQL server on a different PC in your LAN, you should use LAN address of the PC  to connect to MySQL, usually this address looks like 192.168.0.1 or 10.0.0.1, but you should know extract the address.


If you want connect via Internet, your PC with MySQL server should have public IP address (not private), more info:
https://www.iplocation.net/public-vs-private-ip-address

5,479

(2 replies, posted in General)

Example:

procedure Form1_Button1_OnClick (Sender: string; var Cancel: boolean);
begin
    Form1.Memo1.Lines.Add('some text');
    Form1.Memo1.SetFocus;
    Form1.Memo1.SelStart := Length(Form1.Memo1.Text)-1;
end;

5,480

(4 replies, posted in General)

You can use this hack, example you have form frmAbonent to create/edit records and this form have DateTimePicker1 component:

procedure frmAbonent_OnShow (Sender: string; Action: string);
begin
    if frmAbonent.DateTimePicker1.Checked then frmAbonent.DateTimePicker1.Format := ''
    else frmAbonent.DateTimePicker1.Format := ' ';
end;

procedure frmAbonent_DateTimePicker1_OnChange (Sender: string);
begin
    if frmAbonent.DateTimePicker1.Checked then frmAbonent.DateTimePicker1.Format := ''
    else frmAbonent.DateTimePicker1.Format := ' ';
end;

5,481

(5 replies, posted in General)

Hello,


Unfortunately I can't understand what exactly you need.
If you need to save date and time in same field, you should use field type "DATETIME"


Here you can find info, how to choose date and time to store in one field
http://myvisualdatabase.com/help_en/com … icker.html  (section "More information about properties "Calendar"")

5,482

(6 replies, posted in Russian)

Измените данные процедуры таким образом:



procedure Calculate_TCE;
begin
    if (frmVoyage.cbVoyBegins.Checked) and (frmVoyage.cbVoyEnds.Checked) and (frmVoyage.cbVoyEndsTime.Checked) and (frmVoyage.cbVoyBeginsTime.Checked) then
    begin
        if frmVoyage.eddurat.Value <> 0 then
            frmVoyage.edtce1.Value := frmVoyage.edRent.Value / frmVoyage.eddurat.Value;
    end;

end;

procedure Calculate_TCE2;
begin
    if (frmVoyage.cbVoyBegins.Checked) and (frmVoyage.cbVoyEnds.Checked) and (frmVoyage.cbVoyEndsTime.Checked) and (frmVoyage.cbVoyBeginsTime.Checked) then
    begin
        if (frmVoyage.eddurat.Value - frmVoyage.edlost.Value) <> 0 then
            frmVoyage.edtce2.Value := frmVoyage.edRent.Value / (frmVoyage.eddurat.Value - frmVoyage.edlost.Value);
    end;
end;


также я заметил, что кнопка "Add new" на форме Form1, имеет неверное действие, должно быть "New Record"

5,483

(9 replies, posted in General)

Hello,


If MySQL server and My Visual Database located on the same PC, you should use this host:
127.0.0.1
or
localhost

5,484

(13 replies, posted in General)

I checked your project but can't find the code to change keyboard language in your project.
Please let me know where and how you want to change language in your project.

5,485

(6 replies, posted in Russian)

vaskar wrote:

Прилагаю проект

DriveSoft wrote:

также вы можете приложить свой проект с описанием шагов приводящих к этой ошибке.

Вы можете создать событие OnClick для кнопки Поиска, и в этом событии проверять, выбрано ли значение в кобомбокс, пример

procedure Form1_Button1_OnClick (Sender: string; var Cancel: boolean);
begin
    if Form1.ComboBox1.dbItemID = -1 then
    begin
        ShowMessage('Вы должны выбрать значение в ComboBox.');
        Cancel := true;
    end;
end;


Либо вы можете удалить пустое значение из ComboBox, создав событие OnShow для главной формы

procedure Form1_OnShow (Sender: string; Action: string);
begin
    Form1.ComboBox1.dbDeleteRecord (-1); // если нужно убрать первый пустой элемент
    if Form1.ComboBox1.Items.Count>0 then Form1.ComboBox1.ItemIndex := 0; // выбираем первую запись в ComboBox
end;

5,487

(6 replies, posted in Russian)

Перед вычислением необходимо проверять значение делителя, чтобы он не был равен нулю, т.е. в скрипте нужно просто проверить что значение не равно нулю.


например

if (какое либо выражение) <> 0 then
begin
   // здесь прозводим вычисление
end;

также вы можете приложить свой проект с описанием шагов приводящих к этой ошибке.

5,488

(3 replies, posted in General)

Thank you!
I will fix it.

5,489

(6 replies, posted in General)

Sorry, forgot about Last name and First name

procedure frmEmployee_Button2_OnClick (Sender: string; var Cancel: boolean);
begin
     frmEmployee.DBFile1.dbCopyTo := 'files\'+frmEmployee.edLastName.Text+' '+frmEmployee.edFistName.Text+'\a\';
     frmEmployee.DBFile2.dbCopyTo := 'files\'+frmEmployee.edLastName.Text+' '+frmEmployee.edFistName.Text+'\b\';
     frmEmployee.DBFile3.dbCopyTo := 'files\'+frmEmployee.edLastName.Text+' '+frmEmployee.edFistName.Text+'\c\';
end;

5,490

(6 replies, posted in General)

identity
Hello,


Try this script:

procedure frmEmployee_Button2_OnClick (Sender: string; var Cancel: boolean);
var
   sID: string;

begin
     if frmEmployee.Button2.dbGeneralTableid = -1 then sID := SQLExecute('SELECT IFNULL(MAX(id), 0)+1 FROM employees')
     else sID := IntToStr(frmEmployee.Button2.dbGeneralTableid);

     frmEmployee.DBFile1.dbCopyTo := 'files\Record'+sID+'\a';
     frmEmployee.DBFile2.dbCopyTo := 'files\Record'+sID+'\b';  
     frmEmployee.DBFile3.dbCopyTo := 'files\Record'+sID+'\c';  
end;

5,491

(7 replies, posted in General)

Montenegr0 wrote:

Thanks for your help once again.

Another question, i have several combobox with i can insert new items to then, but i have some that i just need them to have Yes and No options, for i dont need to have a new record button..etc to insert them at the first time to these combobox, how can i insert by script default values in the combobox?


Hello,


I made an example for you:

I made some changes in your project:

My Visual Database 2.4
http://myvisualdatabase.com/thank_you_f … ading.html


What's news?
- Opening a database via Web Browser (MySQL)
- Bug fix.



Steps to create ready to use files (html, javascript, php) for web access to database :


1. http://myvisualdatabase.com/forum/misc.php?action=pun_attachment&amp;item=1765&amp;download=0



2.
http://myvisualdatabase.com/forum/misc.php?action=pun_attachment&amp;item=1762&amp;download=0



3.
http://myvisualdatabase.com/forum/misc.php?action=pun_attachment&amp;item=1794&amp;download=0



4.
http://myvisualdatabase.com/forum/misc.php?action=pun_attachment&amp;item=1795&amp;download=0

My Visual Database 2.4
Скачать: http://myvisualdatabase.com/download/myvisualdb.exe



Что нового?
- Доступ к базе данных через  браузер с возможностью поиска, создания, редактирования и удаления записей.
- Небольшие доработки и исправления ошибок.



Подробней:
При использовании в вашем проекте базы данных MySQL, программа может создать для вас готовые к использованию наборы скриптов (html, JavaScript, php), вам остается лишь загрузить полученные файлы на сервер (хостинг) и вы получите доступ к вашей базе данных через  любой браузер, в т.ч. и с мобильных устройств.


Пошаговая инструкция:

1.
http://myvisualdatabase.com/forum/misc.php?action=pun_attachment&amp;item=1761&amp;download=0



2. Создание необходимого количества гридов для доступа к различным таблицам базы данных и их полям.
Также вы можете выбрать поля, по которым хотели бы иметь возможность осуществлять поиск.
После настройки нажмите кнопку Save и укажите папку, в которой будут сохранены необходимы файлы для загрузки на сервер.
http://myvisualdatabase.com/forum/misc.php?action=pun_attachment&amp;item=1762&amp;download=0



3. Внешний вид грида в браузере
http://myvisualdatabase.com/forum/misc.php?action=pun_attachment&amp;item=1794&amp;download=0



4. Редактирование записи
http://myvisualdatabase.com/forum/misc.php?action=pun_attachment&amp;item=1795&amp;download=0

5,495

(7 replies, posted in General)

Please check property BiDiMode, should be bdLeftToRight

Приветствую,


Это можно сделать так

procedure Form1_GridEmployees_OnKeyUp (Sender: string; var Key: Word; Shift, Alt, Ctrl: boolean);
begin
     Form1.DBImage1.Clear;
     Form1.DBImage1.LoadFromDatabase('employees', 'photo', Form1.GridEmployees.dbItemID);
end;

procedure Form1_GridEmployees_OnCellClick (Sender: string; ACol, ARow: Integer);
begin
     Form1.DBImage1.Clear;
     Form1.DBImage1.LoadFromDatabase('employees', 'photo', Form1.GridEmployees.dbItemID);
end;

где 'employees' - это имя БД таблицы, а 'photo' - имя поля из этой таблицы с типом ИЗОБРАЖЕНИЕ

5,497

(7 replies, posted in General)

tcoton
Hello,


May be you changed property BiDiMode to bdRightToLeft  ?

Попробуйте так

SELECT
(SELECT car.carname FROM car WHERE id={cbGroups}) as car,
strftime('%d.%m.%Y', {edbegdate}) as begdate,
strftime('%d.%m.%Y', {edenddate}) as enddate,

SUM(
(
     SELECT SUM(rent.rent / (datediff(rent.`end`, rent.`begin`)+1)) FROM rent WHERE `selected_date` >= rent.`begin` AND `selected_date` <= rent.`end`
     AND (CASE WHEN {ComboBox1}=-1 THEN 1=1 ELSE rent.id_car={ComboBox1} END)
)
)

from

(select adddate('1970-01-01',t4.i*10000 + t3.i*1000 + t2.i*100 + t1.i*10 + t0.i) selected_date from
 (select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t0,
 (select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t1,
 (select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t2,
 (select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t3,
 (select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t4) v

where selected_date between {edbegdate} and {edenddate}

5,499

(2 replies, posted in Script)

Hello,


corrected script:

procedure FrmSearch_GridSearch_OnChange (Sender: string);
var
   i,c: integer;
   s: string;
begin
   c := FrmSearch.GridSearch.RowCount - 1;
     for i := 0 to c do
     begin
         s := FrmSearch.GridSearch.Cells[5,i];
         if ValidDate(s) then
         begin
             if (StrToDate(s) - 15) >= now then FrmSearch.GridSearch.Cell[5,i].Color := clGreen;
             if (StrToDate(s) - 30) < now then FrmSearch.GridSearch.Cell[5,i].Color := clYellow;
             if (StrToDate(s) - 1) < now then FrmSearch.GridSearch.Cell[5,i].Color := clRed;
         end;
     end;
end;

5,500

(6 replies, posted in General)

Hello,


I made an example for you: