Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 填充表时两个相互依赖的查询_Vb.net_Drop Down Menu_Dataset_Focus_Selectedvalue - Fatal编程技术网

Vb.net 填充表时两个相互依赖的查询

Vb.net 填充表时两个相互依赖的查询,vb.net,drop-down-menu,dataset,focus,selectedvalue,Vb.net,Drop Down Menu,Dataset,Focus,Selectedvalue,我有两个问题。一个是填充数据集,该数据集填充dropdownlist,另一个填充表行的其余文本框。我想知道如何填写整个dropdownlist,然后使selectedvalue成为另一个查询中的值 e、 g- 现在桌子看起来像这样- Name DOB Address Hobby Sam 01/10/1988 111 main st Dropdownlist(n number of records) 现在,在dropdownlist中,我希望employee表

我有两个问题。一个是填充数据集,该数据集填充dropdownlist,另一个填充表行的其余文本框。我想知道如何填写整个dropdownlist,然后使selectedvalue成为另一个查询中的值

e、 g-

现在桌子看起来像这样-

Name DOB         Address       Hobby
Sam  01/10/1988  111 main st   Dropdownlist(n number of records)

现在,在dropdownlist中,我希望employee表中填充了嗜好的所有嗜好都是选中的值。

不确定我是否理解,但我会尝试使用一些伪代码

  ## fetch hobbies and employees from db
  dataset hobbies = select hobby from hobbies;
  dataset employees = select name, dob, address, hobby from employee;

  ## loop through all employees
  foreach employee in employees{

    print employee->name;
    print employee->dob;
    print employee->adress;

    ## second loop to print hobbies dropdownlist for each emplyee
    print "<select>";
    foreach hobby in hobbies{
      boolean is_selected = (employee->hobby == hobby);
      print "<option value=\"".hobby."\" selected=\"".is_selected."\">".hobby."</option>";
    }
    print "</select>";
}

这不是正确的html或任何东西,只是一个证明概念的伪代码。

我将从嗜好查询中构建下拉列表开始,然后根据数据集设置下拉列表的选定属性。需要更多代码解释吗。或者在上面处理我的代码
  ## fetch hobbies and employees from db
  dataset hobbies = select hobby from hobbies;
  dataset employees = select name, dob, address, hobby from employee;

  ## loop through all employees
  foreach employee in employees{

    print employee->name;
    print employee->dob;
    print employee->adress;

    ## second loop to print hobbies dropdownlist for each emplyee
    print "<select>";
    foreach hobby in hobbies{
      boolean is_selected = (employee->hobby == hobby);
      print "<option value=\"".hobby."\" selected=\"".is_selected."\">".hobby."</option>";
    }
    print "</select>";
}