B
B
BadCats2020-04-29 17:45:46
MySQL
BadCats, 2020-04-29 17:45:46

MySqlCommand get full response as string?

It is necessary from the response to - to get the full response of the server in order to parse and find the Constraint for the primary key. That is - for example, in phpMyAdmin - it looks like this: How to pull out the entire response as one line in c#?SHOW CREATE TABLE <my_table_name>
5ea992e055abf105727752.png

sql = "SHOW CREATE TABLE `" + TableName_textBox.Text + "`";
                command = new MySqlCommand(sql, conn);
                reader = command.ExecuteReader();
                 reader.Read();

                string s = ??????


Or is there another way besides parsing the response - to get the foreign key and the field of the parent table it refers to?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
d-stream, 2020-04-29
@BadCats

I believe that there is still a way through information_schema and it is more correct than output parsing
As an example:
https://dba.stackexchange.com/questions/102371/how...

E
edward_freedom, 2020-04-29
@edward_freedom

SqlDataReader reader = command.ExecuteReader();
        while (reader.Read())
        {
            Console.WriteLine(String.Format("{0}", reader[0]));
        }

https://docs.microsoft.com/en-us/dotnet/api/system...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question