Jump to content

[MYSQL + C#] Recolher dados com dataset


Recommended Posts

Posted (edited)
string server = "localhost";
string database = "clinica";
string uid= "root";
string password = "";
string MyConString = "SERVER=" + server + ";" +
"DATABASE=" + database + ";" +
"UID=" + uid + ";" +
"PASSWORD=" + password + ";Allow Zero Datetime=true;";
MySqlConnection connection = new MySqlConnection(MyConString);
string sQuery = "Select * from "+query+"";
connection.Open();
MySqlDataAdapter myDA = new MySqlDataAdapter(sQuery, connection);
myDA.SelectCommand.ExecuteReader();
DataTable MyDT = new DataTable();
myDA.Fill(MyDT);
myDA.Update(MyDT);
connection.Close();

Este é o meu código, é para projecto de escola, (estou a começar e quero fazer com mysql + datasets), ando a fazer testes mas não sei como executo algo como datareader aqui no dataset.

Se alguém me poder enviar um pdf ou algo para eu ler e aprender agradeço.

Edited by Caça
GeSHi

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.