在formview中显示SQL数据 [英] displaying SQL data in formview

查看:65
本文介绍了在formview中显示SQL数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我有一个问题我希望有人可以帮助我。

我有一个包含3列/ OrgID的SQL表,SolutionName,ModelDescription

我想要创建一个aspx VB页面,以下面的格式显示数据。问题是它需要自动创建,因为SolutionNames的数量可能因OrgID而异。并且ModelDescription的数量也会因SolutionName的不同而有所不同。

查看我之后如下任何帮助都会很棒。



OrgID < br $>
SolutionName1

ModelDescription1,数量

ModelDescription2,数量

ModelDescription3,数量

ModelDescription4 ,数量

ModelDescription5,数量



SolutionName2

ModelDescription1,数量

ModelDescription2 ,数量

ModelDescription3,数量

Hi i have a question I am hoping someone can help me with please.
I have a SQL table with 3 columns/ OrgID, SolutionName, ModelDescription
I want to create an aspx VB page that shows the data in the below format. The issue is it needs to auto create as the number of SolutionNames can vary by OrgID. and the number of ModelDescription can vary by SolutionName also.
view I am after is as below any help would be great.

OrgID
SolutionName1
ModelDescription1, Quantity
ModelDescription2, Quantity
ModelDescription3, Quantity
ModelDescription4, Quantity
ModelDescription5, Quantity

SolutionName2
ModelDescription1, Quantity
ModelDescription2, Quantity
ModelDescription3, Quantity

推荐答案

请按以下步骤进行操作

1.从数据库中检索数据然后把它放在一个数据表中。

2.现在遍历数据表。

3.为orgid定义一个第一次为空的变量。

4.编写一个if语句,检查变量中的orgid值和数据表中的值(如果它们不同)然后打印orgid的值。

5.同样如此使用解决方案名称。

6.现在在下面的html表格中显示ModelDescription,Quantity的值。



希望我以正确的方式理解您的问题,上述步骤可帮助您实现目标。
Please proceed as follows
1. Retrieve the data from the database and put it in a datatable.
2. Now loop through the datatable.
3. Define a variable for orgid which will be blank for the first time.
4. Write a if statement checking the orgid value in the variable and the value in the datatable if they are different then print the value of orgid.
5. Same goes with the "Solution Name".
6. Now display the value of ModelDescription, Quantity in a html table below it.

Hope I have understood your problem in a correct manner and the above steps help you reach your goal.


这篇关于在formview中显示SQL数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆