Skip to main content

Posts

Showing posts with the label fill data table

Get data from Table using dataTable using c#.net

Get data from Table using dataTable using c#.net static public DataTable getData(string selectstr) { string connectionString = ""; OleDbConnection connection = null; OleDbDataAdapter adp = null; OleDbCommandBuilder oleDbCommandBuilder = null; DataTable dataTable = null; connectionString = ConfigurationSettings.AppSettings["ConnectionString"]; connection = new OleDbConnection(connectionString); connection.Open(); adp = new OleDbDataAdapter(selectstr, connection); oleDbCommandBuilder = new OleDbCommandBuilder(adp); dataTable = new DataTable(); adp.Fill(dataTable); connection.Close(); return dataTable; }