Can someone provide sample code on how to create and fill a DataTable with the table schema and data from a mySQL database?

I found examples where you set up columns and other information programmatically. But i wanted to know if there a way to "sync" the schema in the database table to the DataTable object so you don't have to set up the columns, or keys manually.
Thanks

Do you know what Fill and Update method DataAdapter class does?

Yeah I ended up doing this:

DbCommand command = CreateCommand(com);
			DbDataAdapter adapter = new MySqlDataAdapter();
			adapter.SelectCommand = command;
			DataTable dataTable = new DataTable();

			try
			{
				adapter.Fill(dataTable);
				if(dataTable.Rows.Count > 0)
				{
					return dataTable;
				}
			}
			catch(Exception)
			{
			}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.