从PowerBuilder Classic 12.5中的SQL表填充dropdownlistbox项

编程入门 行业动态 更新时间:2024-10-28 20:20:21
本文介绍了从PowerBuilder Classic 12.5中的SQL表填充dropdownlistbox项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我一直在Vb上工作,但是我切换到了PowerBuilder 12.5 Classic,我发现了自己的方法。我需要知道等效的PowerBuilder脚本;

I have been working on Vb but i switched to PowerBuilder 12.5 Classic, I am finding my way around. I need to know the equivalent PowerBuilder script;

  • 清除控件 textbox1.clear()
  • 聚焦 textbox1.focus()
  • 将SQL数据库项目插入到下拉列表框中
  • While dr.Read ComboBox1.Items.Add(dr("itemname")) end while

    推荐答案

  • textbox1.Reset()
  • textbox1.SetFocus()
  • 示例(未经测试,但显示出了想法):
  • string ls_sql, ls_syntax, ls_errors ls_sql = "select name from users" ls_syntax = sqlca.SyntaxFromSql(ls_sql, "", ls_errors) if len(ls_errors) > 0 then return datastore ds ds = create datastore ds.create(ls_syntax, ls_errors) if len(ls_errors) = 0 then ds.SetTransObject(sqlca) ds.Retrieve() long ll_row,ll_rows string ls_val ll_rows = ds.RowCount() for ll_row = 1 to ll_rows ls_val = ds.GetItemString(ll_row, "name") Combobox1.AddItem(ls_val) next end if destroy ds

    编辑 :正如Terry在回答中所说,Datawindow和DataStore是Powerbuilder的关键控件。将DataStore视为VB记录集,而DW是一种可视记录集(可以以表格,网格等形式显示数据)。

    Edit some comments: as Terry says in its answer, the Datawindow and the DataStore are the key controls of Powerbuilder. Consider the DataStore as a VB recordset and the DW is a kind of visual recordset (that can show the data in the way of a form, a grid, ...).

    我通过使用DS来检索数据并轻松对其进行迭代(比游标更容易操作)来回答了您的问题,我翻译了组合框。但是正如Terry所说,您应该研究如何使用功能更强大,更先进的DropDownDataWindow。

    I answered you question by using a DS to retrieve the data and to easily iterate on it (it is easier to manipulate than a cursor) and I translated the filling of the combobox. But as Terry said, you should study how to use a DropDownDataWindow that is way more powerful and evolutive.

    更多推荐

    从PowerBuilder Classic 12.5中的SQL表填充dropdownlistbox项

    本文发布于:2023-10-31 00:43:44,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1544487.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:Classic   PowerBuilder   dropdownlistbox   SQL

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!