Cant Bind a data from a multi-table Inner Join using C#

Discussion in 'ASP .Net' started by Gareth Stretch, Jun 26, 2003.

  1. Hi Guys. i am using C#.net connecting to an Access database using
    OleDbConnection i am using the following select Statement to join 3
    tables

    string strdvds = "SELECT dvd.name, category.description, dvd.zone,
    dvd.price, dvd.booked_out, dvd.booked_out_date,(contacts.name +' '+
    contacts.surname) as contact FROM (dvd LEFT JOIN category ON
    dvd.category_id = category.id) LEFT JOIN contacts ON dvd.contact_id =
    contacts.id ORDER BY dvd.name ASC";

    the join works well if i run it in acess it returns all the records
    correctly however when i fill the DataAdapter with the following code.
    it gives me the following (see below the method)

    public static DataSet ExecuteDataSet(string constring,CommandType cmd
    , string selectString)
    {
    using (OleDbConnection DBCon = new OleDbConnection(constring))
    {
    DBCon.Open();
    OleDbCommand DBcmd = new OleDbCommand(selectString,DBCon);
    DBcmd.CommandType = cmd;
    OleDbDataAdapter DA = new OleDbDataAdapter();
    DA.SelectCommand = DBcmd;

    DataSet DS = new DataSet();
    DA.Fill(DS);

    return DS;
    }

    }


    ********************ERROR *******************

    IErrorInfo.GetDescription failed with E_FAIL(0x80004005).
    at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32
    hr) at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
    dbParams, Object& executeResult) at
    System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object&
    executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior
    behavior, Object& executeResult) at
    System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
    behavior, String method) at
    System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
    at System.Data.OleDb.OleDbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior
    behavior) at System.Data.Common.DbDataAdapter.FillFromCommand(Object
    data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand
    command, CommandBehavior behavior) at
    System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
    startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
    CommandBehavior behavior) at
    System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String
    srcTable) at dvddetails.classes.DAL.ClsCon.ExecuteDataSet(String
    constring, CommandType cmd, String selectString, String tablename) in
    c:\inetpub\wwwroot\dvddetails\classes\dal\clscon.cs:line 65 at
    dvddetails.classes.BLL.dvds.LoadDvds() in
    c:\inetpub\wwwroot\dvddetails\classes\BLL\dvds.cs:line 90 at
    dvddetails.Forms.addDvd.BindDvds() in
    c:\inetpub\wwwroot\dvddetails\forms\frmddvd.aspx.cs:line 127

    could some please tell me why this is happening. i dont understand the
    error message. is the problem related to the multi-table join. all my
    other grids work with sings table queries using the same
    EXECUTEDATASET method.

    Thanks in advance
    Gareth Stretch
     
    Gareth Stretch, Jun 26, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gene Ariani
    Replies:
    0
    Views:
    2,808
    Gene Ariani
    Aug 21, 2003
  2. mr2_93
    Replies:
    1
    Views:
    3,665
    mr2_93
    Oct 2, 2005
  3. Carlo v. Dango
    Replies:
    14
    Views:
    1,104
    Alex Martelli
    Oct 19, 2003
  4. Pyenos
    Replies:
    2
    Views:
    418
    Pyenos
    Dec 27, 2006
  5. Nagaraj
    Replies:
    1
    Views:
    917
    Lionel B
    Mar 1, 2007
Loading...

Share This Page