473,320 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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

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.ExecuteCommandTextE rrorHandling(Int32
hr) at System.Data.OleDb.OleDbCommand.ExecuteCommandTextF orSingleResult(tagDBPARAMS
dbParams, Object& executeResult) at
System.Data.OleDb.OleDbCommand.ExecuteCommandText( Object&
executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommand(Comm andBehavior
behavior, Object& executeResult) at
System.Data.OleDb.OleDbCommand.ExecuteReaderIntern al(CommandBehavior
behavior, String method) at
System.Data.OleDb.OleDbCommand.ExecuteReader(Comma ndBehavior behavior)
at System.Data.OleDb.OleDbCommand.System.Data.IDbComm and.ExecuteReader(CommandBehavior
behavior) at System.Data.Common.DbDataAdapter.FillFromCommand(O bject
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(Strin g
constring, CommandType cmd, String selectString, String tablename) in
c:\inetpub\wwwroot\dvddetails\classes\dal\clscon.c s: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.c s: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
Nov 17 '05 #1
0 3006

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Fozya | last post by:
Hi, I have problems compiling some code that perfectly runs in VS.Net in the G++. Here is what I got: MyClass a; MyClass b; //assign values to a and b .......
3
by: Me | last post by:
Hi Folks I keep recieving the following error message when i try to bind a combobox to the value that is in a textbox. the application crashes on the following line... Me.CBoxTitle.SelectedItem...
8
by: JohnnySparkles | last post by:
Hi All, I'm working on an application which uses a dll for some of its classes. I build the application and the dll and it runs fine on any machine with Visual Studio .NET installed on it....
3
by: Dmitry Korolyov [MVP] | last post by:
Is that possible? In other words, I want a dropdown list (and other list-type controls) which appears in edit more of a templated column to be populated with data at the run time. An attempt to do so...
2
by: A Traveler | last post by:
Hi, I have a custom collection class i wrote, LineItemsCollection, which is a strongly typed collection of objects of my LineItem class. The LineItem class is a simple class with just a couple...
16
by: Mike Fellows | last post by:
when i load my windows form i populate a combobox i use the code below Dim conn As New System.Data.SqlClient.SqlConnection(strConn) Dim sql As String = "AllLenders" Dim da As New...
12
by: Monty | last post by:
Hope this is an easy one: How can I bind a text on a form to a an integer variable? Possible? Thanks!
2
by: g35rider | last post by:
Hi, I have the following code that is giving this error, I cant simplify the code, I was just testing some theory for something we are doing and was getting an issue here. Please someone point out...
3
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi I have a generic list of data list <typelistcategory; listcategory = new list <type>; I also have a dropdown box that I have put into a template column of a gridview. I was able to populate...
1
by: Linda Liu[MSFT] | last post by:
Hi George, Thank you for posting! This is a quick note to let you know that I am doing research on this issue and will get back to you ASAP. I appreciate your patience! Sincerely,
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.