1

(0 replies, posted in General)

Very good day,

I would appreciate if you would support me. I am trying to get excel to read a column with a specific name, only that I can't find the form, the variable "result_string" is the one that I need to read the column in excel named "Registro", I want to read this column by name, why He's never in the same position

Greetings



procedure Inicio_VALL_OnClick (Sender: TObject; var Cancel: boolean);
var
Excel : Variant ;
Sheet : Variant ;
rows, columns : Integer;
MaxRow : Integer;
MaxCol : Integer;
result_string : string;
sql_string : string ;
sql_string2: string ;
irows : integer ;
sDate : string = FormatDateTime('yyyy-mm-dd', Inicio.DateTimePicker4.DateTime);
Cant:string;
Recaudado:string;
Linea:string;
Bingo:string;
begin

    Excel:=CreateOleObject('Excel.Application');
    //Excel.Visible:= True;
    Excel.Workbooks.Open(Inicio.Edit4.Text) ;
    Sheet := Excel.WorkSheets[1] ;
    MaxRow := Sheet.Usedrange.EntireRow.count ;
    MaxCol := sheet.Usedrange.EntireColumn.count;
    //special excel[row,column]
    irows := 0 ;

    For  rows := 10 To  MaxRow Do
    //columnas a contar de bajada///



    Begin

        For  columns := 1 To 1 Do
        Begin
            result_string := '"'+Excel.ActiveSheet.Cells[rows,2].Text+'"';
            Cant:= '"'+Excel.ActiveSheet.Cells[rows,6].Text+'"';
            Recaudado:= '"'+Excel.ActiveSheet.Cells[rows,17].Text+'"';
            Linea:= '"'+Excel.ActiveSheet.Cells[rows,8].Text+'"';
            Bingo:= '"'+Excel.ActiveSheet.Cells[rows,9].Text+'"';
        End;


         sql_string :=
        'INSERT  central_psa(Jugada,Cant,Recaudado,Sala,Linea,Bingo,Fecha_carga) values('
        +result_string+','+Cant+','+Recaudado+',"Vallarta",'+Linea+','+Bingo+','''+sDate+''');';


       SQLExecute('Delete from central_psa where Cant = 0') ;

        Inicio.Memo4.Lines.Add(sql_string) ;
        irows := irows +1 ;
        result_string := '' ;
        sql_string := '' ;
        Inicio.Label12.Caption := IntToStr(irows);

////ultimo

    End;
    KillTask('EXCEL.EXE');


end;

2

(1 replies, posted in General)

Very good day,

I need your help, I am learning with this great software, I am really dummy, I would be very grateful if you could help me:


1.- That the import from an excel that is in the form1 can have it in the forminicio page tab colima.
2.-My project does not request the connection data to mysql, every time I try to test it asks for the connection data.
3.- know if it is possible to eliminate the start menu or remove the about and other menus at the top.



I would greatly appreciate your help, attached the project.

Iam from Mexico