[英]how to load selected data from database and display in textbox in another form
[英]Get data from database, and show it in a TextBox on another form
就像大家都知道的那样,我几乎解决了这个问题,但是有一个关键项目在我的途中。
好的。 我有一个“ DataModule”类,其中有几个DataAdaptor,我的DataSet和Connection。
我的数据库工作正常,保存和检索(包括更新和删除)数据也是如此。 如果我在DataModule窗体上放置一个TextBox,并使用OleDbReader和以下语句:txtBoxTest.Text = reader [“ firstName”]。ToString();
然后,所选记录(我已通过ID号选择的)的名字出现在框中。
但是,此数据出现的实际位置在另一个表单上,并且众所周知,Windows窗体应用程序上的组件默认情况下设置为“专用”。 因此,我的困境。
问题在这条线下
如何使用DataModule类的阅读器以及提供的代码声明使数据显示在正确的表单的TextBoxes(即PatientRecord.cs)中?
非常感谢!
表单之间的数据传输有一些方法。我解释一种常见的方法:
发件人表格:
FrmChild child = new FrmChild(number,line,this.Width);
child.Owner = this;
child.Show();
接收方表格:
public partial class FrmChild : Form
{
int frmw;//A public varaible
public FrmChild()//normal constrauctor
{
InitializeComponent();
}
public FrmChild(String cNumber,byte LINE,int w)//custom constrauctor
{
frmw = w;
InitializeComponent();
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.