How do I run a query that makes table in Access through C#? -


I need to run a query called "MyQuery" which is in my access, which creates a table.

How do I run this query in the C # code?

Take a look, that actually looks like your problem.

Your code might look like this:

  using System.Data; Using system.Data (IDbConnection conn = new using OleDbConnection (...) // // < - Add connection string {conn.Open (); Try {IDbCommand command = conn.CreateCommand (); // Option 1: command.CommandText = "Select ... from MyQuery"; // Option 2: command.CommandType = CommandType.TableDirect; Command. CommodityText = "MyClu"; // Option 3: Command Type command = command type .stressprocessor; Command. CommodityText = "MyClu"; (Using the IDataReader reader = command.ExecuteReader ()) {// do something with the result set obtained by the reader ...}} {conn.Close (); }}  

Comments