G
Guest
I've seem to have found a bug in ado.net:
I'm using visual studio 2003
and trying to connect to visual fox pro dbase ( i think version 8.0)
using the OleDb* components.
I've created the OleDbConnection and OleDbDataAdapter using the visual
studio wizards
and I run the SQL statements using:
try {
this.oleDbSelectCommand1.CommandText = "....";
DataTable dt=new DataTable();
oleDbDataAdapter1.Fill(dt);
dataGrid1.DataSource=dt;
} catch (Exception ex) {
MessageBox.Show(ex.ToString());
}
and I've run across a strange problem:
when I run this sql statement:
SELECT fldirord.order_num
FROM fldirord,fldirg
LEFT OUTER JOIN FLDORDF ON fldirord.FU_ID = FLDORDF.FU_ID
I get an error:
System.Data.OleDb.OleDbException: SQL: Column 'FU_ID' is not found.
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(DataTable dataTable, IDbCommand
command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
at testSQL.Form1.button2_Click(Object sender, EventArgs e) in
c:\\projects1.1\\utils\\testsql\\form1.cs:line 191
The strange thing is :
1. this statement works OK: ( I removed the "fldirg" table from the 'from'
line)
SELECT fldirord.order_num
FROM fldirord
LEFT OUTER JOIN FLDORDF ON fldirord.FU_ID = FLDORDF.FU_ID
2. this statement also works OK: ( I changed the LEFT OUTER JOIN to a WHERE)
SELECT fldirord.order_num
FROM fldirord,fldirg,FLDORDF
where (fldirord.FU_ID = FLDORDF.FU_ID)
3. if I execute the original SQL statement (that fails) using CuteSQL
(connecting to the dbase using ODBC) it works!
If anybody got any idea what is happenning here,and how to fix this problem
please let me know
Thanks
Nadav
I'm using visual studio 2003
and trying to connect to visual fox pro dbase ( i think version 8.0)
using the OleDb* components.
I've created the OleDbConnection and OleDbDataAdapter using the visual
studio wizards
and I run the SQL statements using:
try {
this.oleDbSelectCommand1.CommandText = "....";
DataTable dt=new DataTable();
oleDbDataAdapter1.Fill(dt);
dataGrid1.DataSource=dt;
} catch (Exception ex) {
MessageBox.Show(ex.ToString());
}
and I've run across a strange problem:
when I run this sql statement:
SELECT fldirord.order_num
FROM fldirord,fldirg
LEFT OUTER JOIN FLDORDF ON fldirord.FU_ID = FLDORDF.FU_ID
I get an error:
System.Data.OleDb.OleDbException: SQL: Column 'FU_ID' is not found.
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(DataTable dataTable, IDbCommand
command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
at testSQL.Form1.button2_Click(Object sender, EventArgs e) in
c:\\projects1.1\\utils\\testsql\\form1.cs:line 191
The strange thing is :
1. this statement works OK: ( I removed the "fldirg" table from the 'from'
line)
SELECT fldirord.order_num
FROM fldirord
LEFT OUTER JOIN FLDORDF ON fldirord.FU_ID = FLDORDF.FU_ID
2. this statement also works OK: ( I changed the LEFT OUTER JOIN to a WHERE)
SELECT fldirord.order_num
FROM fldirord,fldirg,FLDORDF
where (fldirord.FU_ID = FLDORDF.FU_ID)
3. if I execute the original SQL statement (that fails) using CuteSQL
(connecting to the dbase using ODBC) it works!
If anybody got any idea what is happenning here,and how to fix this problem
please let me know
Thanks
Nadav