4
I’m searching several tables from the database for a Dataset
through a Stored Procedure
in the MySQL
using the Mysql Workbrenck, but when saving only the first table is saved, my code:
Stored Procedure:
CREATE DEFINER=`root`@`localhost` PROCEDURE `Tabelas_Materia_Prima`()
BEGIN
SELECT * FROM materia_prima_ar order by 'DATA';
SELECT * FROM materia_prima_amido order by 'DATA';
SELECT * FROM materia_prima_art order by 'DATA';
SELECT * FROM materia_prima_umidade order by 'DATA';
SELECT * FROM materia_prima_pol order by 'DATA';
SELECT * FROM materia_prima_infeccao order by 'DATA';
SELECT * FROM materia_prima_imp_veg order by 'DATA';
SELECT * FROM materia_prima_imp_min order by 'DATA';
SELECT * FROM materia_prima_fosfato order by 'DATA';
SELECT * FROM materia_prima_fibra order by 'DATA';
SELECT * FROM materia_prima_dextrana order by 'DATA';
END
Method to save Dataset again:
public void Salvar_Procedure(DataSet Dados, string Nome_Procedure)
{
MySqlConnection Conexao = new MySqlConnection(StringConexao);
//OdbcConnection Conexao = new OdbcConnection("DSN=YasFashion_Sacoleiro_DB");
MySqlCommand Comando = new MySqlCommand();
Comando.Connection = Conexao;
Comando.CommandType = CommandType.StoredProcedure;
Comando.CommandText = Nome_Procedure;
MySqlDataAdapter Meu_Adaptador = new MySqlDataAdapter(Comando);
//OdbcDataAdapter Meu_Adaptador = new OdbcDataAdapter("SELECT * FROM " + Nome_Tabela, Conexao);
try
{
Conexao.Open();
MySqlCommandBuilder Comando01 = new MySqlCommandBuilder(Meu_Adaptador);
//OdbcCommandBuilder Comando = new OdbcCommandBuilder(Meu_Adaptador);
Meu_Adaptador.Update(Dados);
Conexao.Close();
}
catch (Exception ex)
{
MessageBox.Show("Erro de salvamento: \n" + ex);
}
}
You want to use the PROCEDURE Table_materia_press() as a return select of all the select you have in it?
– Marco Souza