個々のテーブルから取得する必要がありますが、同じ列名からstring array
に値を取得する必要があります。私は私が持っているテーブルの名前は何もありませんが。私は彼らがすべて列名「電子メール」を持っていることだけを知っています。C#で特定の列から文字列配列にすべてのテーブルを選択する方法
string connectionString = "SERVER=********;PORT=****;DATABASE=********;UID=********;PASSWORD=******;";
MySqlConnection conn = new MySqlConnection(connectionString);
MySqlCommand command = conn.CreateCommand();
try
{
conn.Open();
command.CommandText = "SHOW FULL TABLES FROM ExampleDataBase";
}
catch
{
MessageBox.Show("error");
}
MySqlDataReader reader;
reader = command.ExecuteReader();
while (reader.Read())
{
string usermail = reader.GetString("email");
string[] mail = new String[] { usermail};
foreach (string s in mail)
{
listboxMails.Items.Add("email: " + s)
}
}
複数のアカウントで重複する可能性があるため、DBが主キー列をユーザーの電子メールアドレスに設定するとは思わないので、おそらく(IsPrimaryKey = true)は必要ありません。 –