Step 1: Download MySql.Data.dll and add
referance of it.
Step 2: Add Namespace as given
using
MySql.Data.MySqlClient;
using
MySql.Data;
step 3: Use this function to get columnlist by passing tablename and
connectionstring in string format.
public
DataTable ColumnList(string connection,
string tablename, bool
identity)
{
MySqlConnection conn
= new MySqlConnection(connection);
DataTable dt =
new DataTable();
MySqlCommand cmd =
new MySqlCommand("select
COLUMN_NAME as 'name' from information_schema.columns where table_name=@t_name",
conn);
cmd.Parameters.AddWithValue("@t_name",
tablename);
MySqlDataAdapter
da = new MySqlDataAdapter(cmd);
da.Fill(dt);
return dt;
}
Step 4: Use "dt" as per your need.