当我使用vb.net单击gridview时如何在文本框中显示数据 [英] how to display data in textbox when i click gridview using vb.net

查看:241
本文介绍了当我使用vb.net单击gridview时如何在文本框中显示数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi
i有一个问题的朋友,我正在使用vb.net开发发票应用程序我想在我点击gridview时间时显示来自数据库的数据但是这里的一个问题是gridview显示另一个表详细信息,但是我想要显示如下......



这是发票数据库gridview

发票ID /总金额/余额
1/10000/1000
2/5000/500







这是资产负债表数据

发票ID / AMOUNT付款/余额
1 / 500/500




i想要::

当我从网格视图中点击发票ID 1表示textbox1值=1textbox2 value =10000和textbox3 value =相应的BALANCE AMOUNT来自余额表值,我的意思是

textbox3值=500



请帮我...

解决方案

您需要修改查询,即为您提取数据。

您必须加入表格,并获得所需的列数据。

然后你就可以轻松绑定了。



如下所示...

  SELECT  invoiceTable.InvoiceID,
invoiceTable.TotalAmount,
balanceTable.balance
FROM
invoiceTable
INNER JOIN
balanceTable
ON
invoiceTable.InvoiceID = balanceTable.InvoiceID



修改表名和列根据您的结构命名。


hi i have one problem friends, i am using vb.net developing the invoice application i want to show the data from database when i click gridview time but one problem is here in that gridview show the another table details, but i want to show like below...

This is invoice DB gridview

INVOICE ID  /  TOTAL AMOUNT  /  BALANCE
1           /      10000     /   1000
2           /       5000     /   500




This is balance table data

INVOICE ID  / AMOUNT PAID / BALANCE
 1          /     500     /   500



i want::
when i click the invoice id 1 from grid view means the textbox1 value ="1 "textbox2 value ="10000" and textbox3 value= the corresponding BALANCE AMOUNT from balance table value, i mean
the textbox3 value="500"

pls help me...

解决方案

You need to modify the query, which is fetching the data for you.
You have to join the tables, and get the desired columns data.
Then you can bind easily.

Something like below...

SELECT  invoiceTable.InvoiceID, 
        invoiceTable.TotalAmount,
        balanceTable.balance
FROM
        invoiceTable
    INNER JOIN
        balanceTable
    ON
        invoiceTable.InvoiceID = balanceTable.InvoiceID


Modify the Table names and Column Names as per your structure.


这篇关于当我使用vb.net单击gridview时如何在文本框中显示数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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