0

I have a DataRepeater template control with 2 textboxes which I want to associate data from a mysql table

When I run this program I get the representation on my DataRepeater the number of rows existing in my mysql table

RESULT

my question is how to associate the data to those textboxes

    private void Form1_Load(object sender, EventArgs e)
    {
        BindLviewData();
    }

    protected void BindLviewData()
    {                  
            System.Data.DataTable dt = new System.Data.DataTable("db.myTable");
            MySqlConnection dbConn = new MySqlConnection("Server = localhost; Database = db; Uid = wwww; Pwd = www; ");
            dbConn.Open();

            string query = string.Format("SELECT Col1,Col2 FROM myTable");

            MySqlCommand cmd = new MySqlCommand(query, dbConn);
            MySqlDataAdapter returnVal = new MySqlDataAdapter(cmd);
            returnVal.Fill(dt);
            BindingSource bs = new BindingSource();
            bs.DataSource = dt;
            dataRepeater1.DataSource = bs;

            dbConn.Close();
    }
Mehmet Topçu
  • 1
  • 1
  • 16
  • 31
meddy03
  • 1
  • 3
  • The same way you would with any ADO.NET data source. This has nothing to do with MySQL. Did you check any ASP.NET tutorial that covers repeaters, like [this one](https://msdn.microsoft.com/en-us/library/zzx23804(v=vs.85).aspx)? There are a *lot* of them. They are old, because Data repeaters are old, available since 2005 at least. The simplest solution is to just use data binding syntax, `Text='<%# Eval("CategoryName") %>'` – Panagiotis Kanavos Jul 03 '17 at 08:57
  • If you look for *Winforms* data repeaters, there are a lot of docs and tutorials too , like [this one](https://msdn.microsoft.com/en-us/library/cc425007(v=vs.80).aspx) from MSDN – Panagiotis Kanavos Jul 03 '17 at 09:00

0 Answers0