Ask a Question related to ASP.NET General, Design and Development.
-
Gareth Stretch #1
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
Gareth Stretch Guest
-
4 table JOIN problem
I am struggling to come up with the proper JOIN syntax for this SQL query. It is for an Access Database. I am receiving a column name... -
How to pull the data out from two table and bind to repeater
HI All, Can somebody help what's wrong with my SQL Query statement when i want to create a join table query. It suppose work perfectly fine, but... -
Delete with a multi-column join?
Howdy! I apologize in advance for the ugly query I'm about to throw your way.... I need to delete some data from a table based on a multi-column... -
Join on virtual table
Hi. I'd like to return a result set from a plpgsql function constructed out of a 'virtual table' joined to an actual table, and struggling to find... -
show the nested table as a column and bind it to data grid
Hi I am using the XML that is hierarchial and when I load the XML into dataset and bind the dataset to datagrid, I was not able to see the low level...



Reply With Quote

