zoukankan      html  css  js  c++  java
  • 保存工资到记事本的写法

    需要加一个savedialog组件然后写入以下代码

     

    复制代码
     1 procedure TForm3.N7Click(Sender: TObject);
     2 var
     3 MyList: TStringList;
     4 MyAdoq: TADOQuery;
     5 I: Integer;
     6 myfieldvalue,myfieldName,mystr: string;
     7 begin
     8   MyList := TStringList.Create;
     9   MyAdoq := TADOQuery.Create(nil);
    10   MyList.Clear;
    11   try
    12       MyAdoq.Connection := frmDataPool.ADOConnection1;
    13       mystr:='' ;
    14       myList.Clear;
    15       frmDataPool.qry工资表.First;
    16       while not frmDataPool.qry工资表.Eof do
    17        begin
    18        for i := 0 to frmDataPool.qry工资表.FieldDefs.Count - 1 do
    19        begin
    20        //myfieldName := frmDataPool.qry工资表.FieldDefs[i].Name;
    21        myfieldName:= frmDataPool.qry工资表.Fields[I].FieldName;
    22        myfieldvalue:= frmDataPool.qry工资表.FieldByName(myfieldName).AsString;
    23        mystr:=mystr+myfieldname+''+':'+''+'('+myfieldvalue+')'+''+';';
    24        //ShowMessage(myfieldName);
    25        //ShowMessage(myfieldvalue);
    26        //ShowMessage(mystr);
    27        end;
    28        myList.Add(mystr);
    29        mystr:='' ;
    30        frmDataPool.qry工资表.Next;
    31        end;
    34       if SaveDialog1.Execute then
    35       MyList.SaveToFile(SaveDialog1.FileName);
    36   finally
    37   MyList.Free;
    38   MyAdoq.Free;
    39   end;
    40 end;
    复制代码
  • 相关阅读:
    04-增删改查
    03-编写dao实现类方式
    02-基于注解的入门案例
    .net core api 图片上传与加载
    笔记一、数据库初始化 约定
    .net core MVC中级教程(四)
    .net core MVC中级教程(三)
    Windows 盘符映射
    c# 队列和堆栈
    isValidNode
  • 原文地址:https://www.cnblogs.com/ddxxxb/p/6803216.html
Copyright © 2011-2022 走看看