更新时间:2023-02-26 10:07:25
参考:获取表格列mysql中的名称? [ ^ ]
Below is my c# code i want table column name
try
{
using (MySqlConnection con = new MySqlConnection(txtOtherConStr.Text.Trim()))
{
MySqlConnectionStringBuilder builder = new MySqlConnectionStringBuilder(txtOtherConStr.Text.Trim());
string db = builder.Database;
using (MySqlCommand cmd=new MySqlCommand("SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = "+ db +" AND TABLE_NAME =@TABLE_NAME",con))
{
cmd.Parameters.Add("@TABLE_NAME", MySqlDbType.VarChar).Value = lbOtherTable.SelectedValue;
new MySqlDataAdapter(cmd).Fill(dt);
}
}
}
catch { }
This is my sql query but i am not get pls help me is some know solution
SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = "+ db +" AND TABLE_NAME =@TABLE_NAME
refer: Get table column names in mysql?[^]