如何从SQL Server到文本框中的Visual Studio中获取数据? [英] how to get data from sql server to visual studio in textbox?
本文介绍了如何从SQL Server到文本框中的Visual Studio中获取数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的编码员,
我想获得有关在文本框中将数据从sql server提取到Visual Studio的帮助.实际上,我是通过从datagridview派生数据然后到文本框来进行此工作的.但是现在我真的需要一条直接将数据直接传递到文本框的途径.请帮忙.
Dear Coders,
I would like to have some help regarding fetch the data from sql server to visual studio in a textbox. I actually had worked on this by deriving data from a datagridview and then to a text box. But now i really need a straightway to get the data directly to the textbox. Please Help.
推荐答案
将您从数据库中检索到的值填写到数据集中,并像
那样进行分配
fill your retrieved value from database in dataset and assign like
TextBox1.Text=ds.Tables(0).Rows(0).Item("columnname").value
armarzook,
我建议您使用BindingSource控件来实现此目的.
有关详细信息,您可以参考下面的链接:
创建.NET数据库应用程序的最快方法 [ ^ ]
希望这会有所帮助!
快乐编码:)
最好的问候,
Sunny K
Hi armarzook,
I would suggest you to use a BindingSource control to achieve this purpose.
For details, you can refer to the link below:
Quickest Way to Create a .NET Database Application[^]
Hope this helps!
Happy Coding :)
Best Regards,
Sunny K
嗨 可能是您的问题是网格文本框分配了正确的日期基值
Hi may be your problem is grid textbox assigning your datebase value thats right
protected void gridview1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
Textbox TextBox1= ((Textbox)e.Row.FindControl("textboxID"));
TextBox1.Text=ds.Tables(0).Rows(0).Item("columnname").value
}
}
请检查一个
pls check that one
这篇关于如何从SQL Server到文本框中的Visual Studio中获取数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文