Marvin kakuru

Marvin kakuru

  • 1.4k
  • 359
  • 160.8k

dafill error

Mar 6 2012 10:53 PM
 

Hi there,

I am using the code below, but it is generating errors I am using an access database

OleDbConnection cn = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\katoto\Documents\Visual Studio 2010\Projects\Genesis Philcollins\data\thyfarm.accdb;Jet OLEDB:Database Password=Kyozi");

            string sql = ("select motherUIC,mother,UIC,Nam,animalsex,TagNo,Status,Owner,day,Dat,wkno,mont,yr,presence from Herdregistar where DATEDIFF(day, [dat], Date()) >= 90 AND status like '" + "Incalf" + "'");

            DataSet ds;

           

            OleDbCommand cmd = new OleDbCommand();

            OleDbDataAdapter da = new OleDbDataAdapter();

            //SqlDataReader dr = new SqlDataReader();

cmd = new OleDbCommand(sql, cn);

            da = new OleDbDataAdapter(cmd);

            ds = new DataSet();

 

            da.Fill(ds, "select motherUIC,mother,UIC,Nam,animalsex,TagNo,Status,Owner,day,Dat,wkno,mont,yr,presence");

            dataGridView1.DataSource = ds.Tables[0];

 

the error indicates the above code in yellow shade and it states " Invalid procedure call"

 

how can overcome this.

Thanks.Best Regards


Answers (2)