遗忘海岸

江湖程序员 -Feiph(LM战士)

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

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

posted on   遗忘海岸  阅读(433)  评论(0编辑  收藏  举报

编辑推荐:
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
阅读排行:
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· .NET周刊【3月第1期 2025-03-02】
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· [AI/GPT/综述] AI Agent的设计模式综述
点击右上角即可分享
微信分享提示