[英]returning data table to text boxes
How do i return data from my data table into the textboxes on my form? 如何将数据表中的数据返回到表单上的文本框?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BLL
{
public class tickets
{
public DAL.TicketsDataSet.TicketDetailsDataTable GetData()
{
DAL.TicketsDataSetTableAdapters.TicketDetailsTableAdapter TicketDetailsTableAdapter1 = new DAL.TicketsDataSetTableAdapters.TicketDetailsTableAdapter();
return TicketDetailsTableAdapter1.GetTicketDetails();
}
}
}
My TicketDetails.xsd 我的TicketDetails.xsd
From the likes of your code, you're using DataSet(xsd) in visual studio, try doing this. 从您喜欢的代码来看,您正在Visual Studio中使用DataSet(xsd),请尝试执行此操作。
Check if you have a Fill() command from your table 检查表中是否有Fill()命令
Code like this 像这样的代码
// testdbDataSet came from here // testdbDataSet来自这里
// initialize your data table from the dataset //从数据集中初始化数据表
testdbDataSet.testtableDataTable ts = new WindowsFormsApplication1.testdbDataSet.testtableDataTable(); ts = new WindowsFormsApplication1.testdbDataSet.testtableDataTable();
// fill your datatable using the Fill command //使用Fill命令填充数据表
testtableTableAdapter.Fill(ts); testtableTableAdapter.Fill(TS);
// get the record from the rowIndex and columnIndex to your textbox or string //将记录从rowIndex和columnIndex获取到您的文本框或字符串
string test = ts.Rows[0][0].ToString();` 字符串测试= ts.Rows [0] [0] .ToString();`
This is how it worked in my case. 这就是我的情况。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.