slow fill

D

D

I am experiencing slow response from my fill command.
I am trying to open a database and one table and add data at some point.
Is there a way to just open the table without all the data being read in
when using my fill on my dataadapter.
Is there a more efficient way to instantiate my dataadpter
Below is my code:

Thanks

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.Common;
using System.Data.Odbc;
using System.Collections;
using System.IO;


namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
OdbcConnection dbconn = new
OdbcConnection("Provider=MSDASQL.1;DRIVER={Microsoft Access Driver
(*.mdb)};DBQ=c:\\hedgefunds\\db1.mdb;DATABASE=db1;UID=root;PWD=;
OPTION=1;");
dbconn.Open();
OdbcDataAdapter dbrs = new OdbcDataAdapter("Select * From
MyTable;", dbconn);
OdbcCommandBuilder builder = new OdbcCommandBuilder(dbrs);
DataSet dbADOrs = new DataSet();

InitializeComponent();
dbrs.MissingSchemaAction = MissingSchemaAction.AddWithKey;
dbrs.Fill(dbADOrs);
OpenReturnFile(dbrs, dbADOrs);


}
 
A

Alberto Poblacion

D said:
I am experiencing slow response from my fill command.
I am trying to open a database and one table and add data at some point.
Is there a way to just open the table without all the data being read in
when using my fill on my dataadapter.

Use FillSchema instead of Fill.
Or change the Select statement so that it has an "impossible" Where
clause. This will not bring in any data, but it will not prevent you from
adding new records.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top