How to display DB data in Windows application?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I want to display the DB data in a tabcontrol. There is a textbox insides that tabcontrol

<code
private void Bind_DBData(

string strSql = "select * from table WHERE id > 0 order by id"
DataSet ds = new DataSet()
tr

ds = SqlHelper.ExecuteDataset(DBConnection.ConnString,
CommandType.Text,
strSql)

catch(Exception


this.textBox1.Text += this.id + " " + this.content + " " + this.status
+
"\r\n"

</code

The above code only displays one row of record

In other web controls such as dropdownlist, radiobutton, checkboxlist, I can use the following to do data binding

//this.textBox1.DataSource = ds.Tables[0].DefaultView
//this.textBox1.DataTextField = "content"
//this.textBox1.DataValueField = "id"
//this.textBox1.DataBind()

However, how can I list all rows in DB table in a tabcontrol? Should I use textbox? I did not write window application before, thanks for help
 
TextBox control is interested in displaying only one value hence reads only
one row. if you have to display all rows at a time, consider the option of
changing text box to drop down list.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top