数据集值分配给文本框 [英] dataset value assignment to textbox

查看:68
本文介绍了数据集值分配给文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我项目的代码...

请告诉我如何从数据集中获取值并显示到文本框,




following is the code of my project...

please tell me how to get values from dataset and show to textboxes ,




 SqlConnection cn = new SqlConnection("Data Source=SomePC\\SQLEXPRESS;Initial Catalog=SomeDB;Integrated Security=True;");

da = new SqlDataAdapter("select * from clubAC where accountno=" + txtacno .Text + "", cn);
ds = new DataSet();
cn.Open();
da.Fill(ds, "clubAC");



我想展示...
textbox1.text = ..........来自数据集的值.



i want to show...
textbox1.text=..........value from dataset.

推荐答案

TextBox1.Text=ds.Tables[0].Rows[0][0].ToString();



希望对您有所帮助.



Hope this can help you.


textbox1.text = Dataset.Tables[0].Rows[0][0].ToString();



供您参考

在C#.NET中显示数据集中的数据 [



For your information

Display Data from a Dataset in C# .NET[^]


您不能这样做.您可以将1列显示在textbox1.Text下.

如果要显示textbox1.Text下所有列的所有值,则必须将所有值合并为一个字符串值.
You cannot do that. You can take 1 column and show it under textbox1.Text.

If you want to show all values from all columns under your textbox1.Text, you have to concat all values to one string value.


这篇关于数据集值分配给文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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