meddy03
meddy03

Reputation: 1

How to associate mysql data to DataRepeater controls

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();
    }

Upvotes: 0

Views: 33

Answers (0)

Related Questions