zoukankan      html  css  js  c++  java
  • PB代码参考段

    访问数据库存储过程:

    --存储过程定义---(使用ODBC sql2008驱动)

    Create Proc [dbo].[Category_Query]
    As
    Select CategoryId,Categoryname,Description From Categories

    --访问代码-----

     int categoryid;
     string categoryName,description;
     DECLARE CategoryQuery PROCEDURE FOR category_query  ;
     Execute CategoryQuery;


     Fetch CategoryQuery Into :categoryid, :categoryName,:description;
     Do While sqlca.sqlnrows >0;
       MessageBox(categoryName,description);
       Fetch CategoryQuery Into :categoryId, :categoryName,:description;
     Loop
     
     Close CategoryQuery;

    /********************************************************./

    触发双击材料选择事件
    dwobject ldwo
    ldwo = dw.object.__get_attribute('contract_instance', true)
    dw.event clicked( 0, 0,newrow, ldwo)

    //************************************************

    获取dw字段Title与Name
    1.title部分
    string dw_name
    long ll_rows ,i
    ll_rows=long(dw_1.describe( 'datawindow.column.count '))
    dw_name=dw_1.dataobject
    for i=1 to ll_rows
     dw_columnname[i]=dw_1.describe(dw_1.describe( "#"+string(i)+".Name")+"_t.text")
     ddlb_3.additem(dw_columnname[i])
    next

    2.Name部分
    dw_1.describe( "#"+string(i)+".Name")

    3.根据指定列排序

    string newsql
    newsql=oldsql
    string ls_columnnametext,ls_employeeinstence,ls_columnname
    string ls_compositor

    //newsql=newsql+" where sequence <> 0  "
    int i
    ls_columnnametext=trim(ddlb_3.text)
    if ls_columnnametext<>"" and not isnull(ls_columnnametext) then
     for i=1 to upperbound(dw_columnname)
      if dw_columnname[i]=ls_columnnametext then
       exit
      end if
     next
      ls_columnname=dw_1.describe( "#"+string(i)+".Name")
      newsql=newsql+" order  by "+ls_columnname+" "
      ls_compositor=trim(ddlb_2.text)
      if ls_compositor<>"" and not isnull(ls_compositor)  then
      if ls_compositor="降序" then
        newsql=newsql+"desc"
      else
       newsql=newsql+"asc"
       end if
     end if
    end if

    dw_1.setsqlselect( newsql)
    dw_1.retrieve()

     //==============================
    一个Excel VBA

    Private Sub btnQuery_Click()

        Dim v, firstAddress, rowIndex
        v = txtCode.Text
        If v = Empty Or v = "" Then
          MsgBox "未输入厂家代码"
          Exit Sub
        End If
       
        '//清除内容
        Sheet2.Range("A5:Z60000").ClearContents

        rowIndex = 5
        With Worksheets(1).Range("c1:c60000")
            Set c = .Find(v, LookIn:=xlValues)
            If Not c Is Nothing Then
                firstAddress = c.address

                Do
                 
                   
                    '//指定的返回数不为零的复制到当前sheet中
                    If Sheet1.Cells(c.Row, 10).Value <> 0 Then
                      '//复制找到的行
                      Sheet1.Rows(c.Row).Copy Sheet2.Cells(rowIndex, 1)
                      rowIndex = rowIndex + 1
                    End If
                    Set c = .FindNext(c)

                 
                 
                Loop While Not c Is Nothing And c.address <> firstAddress
            End If
        End With

     //======================================

    PB中获取dw的选中行数

    long selectedRow

    selectedRow=long(dw_1.describe("evaluate('sum( if(IsSelected(), 1, 0) for all)',1)"))  

    if selectedRow<=0 then
     messagebox("提示","无任何选中的行!");
     return;
    end if

  • 相关阅读:
    sql server 删除重复数据新思路
    sqlserver 迁移 mysql
    ASP.NET Web deployment task failed. 请与服务器管理员联系,检查授权和委派设置 部署任务失败的解决方案
    数据库交互之减少IO次数
    sqlserver 安全设置
    windows设置相对路径的快捷方式
    利用SignalR实现实时推送信息
    image magick 备忘
    dotnetCore开发中遇到的一些问题
    “NETSDK1061: 项目是使用 Microsoft.NETCore.App 版本 2.1.14 还原的, 但使用当前设置, 将改用版本 2.1.0。”的处理方法
  • 原文地址:https://www.cnblogs.com/wdfrog/p/2163391.html
Copyright © 2011-2022 走看看