Exception on select command while access finds it ok

V

Versteijn

Hello all,

I have this command:

"SELECT Modellen.* FROM IntropaginaIndelingen, Modellen " & _
"WHERE IntropaginaIndelingen.Model1ID = Modellen.ModelID"

When I execute and output my commandtext and paste that in Access, it
works fine. When I try to execute it through OleDb, it fails with this
exception:


[OleDbException (0x80040e10): No value given for one or more required
parameters.]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32
hr) +41
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
dbParams, Object& executeResult) +174
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object&
executeResult) +92
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior
behavior, Object& executeResult) +65
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
behavior, String method) +112
System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior
behavior) +69
System.Data.OleDb.OleDbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior
behavior) +5
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +38
MediaMaker.Tools.DataAccess.DbCommand.executeDataSet() in
C:\Documents and Settings\David\Mijn documenten\Visual Studio
Projects\MedMakTools\MediaMaker.Tools\DataAccess\DbCommand.vb:106
T2.DataAccess.ModelDalc.SelectIntroModel(Int32 Ref) in C:\Documents
and Settings\David\Mijn documenten\Visual Studio Projects\T
Site\DataAccess\ModelDalc.vb:234


I'n confused. When I leave the 'where' part, it works fine.
Any ideas?

Regards,

Freek Versteijn
 
C

Cowboy \(Gregory A. Beamer\)

Just for a test, try:

"SELECT Modellen.* FROM IntropaginaIndelingen JOIN Modellen " & _
"ON IntropaginaIndelingen.Model1ID = Modellen.ModelID"

This is more MS-centric SQL (which also conforms to ANSI SQL, BTW).

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

**********************************************************************
Think Outside the Box!
**********************************************************************
 
V

Versteijn

Hi Gregory,

I tried that already, but it did not work either. Solution: add the
field Model1ID to the table :D I did that but apparently overwrote the
database file or forgot to save it.

Howver, thank you for your help

Regards,

Freek Verstejin



Cowboy \(Gregory A. Beamer\) said:
Just for a test, try:

"SELECT Modellen.* FROM IntropaginaIndelingen JOIN Modellen " & _
"ON IntropaginaIndelingen.Model1ID = Modellen.ModelID"

This is more MS-centric SQL (which also conforms to ANSI SQL, BTW).

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

**********************************************************************
Think Outside the Box!
**********************************************************************
Versteijn said:
Hello all,

I have this command:

"SELECT Modellen.* FROM IntropaginaIndelingen, Modellen " & _
"WHERE IntropaginaIndelingen.Model1ID = Modellen.ModelID"

When I execute and output my commandtext and paste that in Access, it
works fine. When I try to execute it through OleDb, it fails with this
exception:


[OleDbException (0x80040e10): No value given for one or more required
parameters.]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32
hr) +41
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
dbParams, Object& executeResult) +174
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object&
executeResult) +92
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior
behavior, Object& executeResult) +65
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
behavior, String method) +112
System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior
behavior) +69
System.Data.OleDb.OleDbCommand.System.Data.IDbCommand.ExecuteReader(CommandB
ehavior
behavior) +5
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +38
MediaMaker.Tools.DataAccess.DbCommand.executeDataSet() in
C:\Documents and Settings\David\Mijn documenten\Visual Studio
Projects\MedMakTools\MediaMaker.Tools\DataAccess\DbCommand.vb:106
T2.DataAccess.ModelDalc.SelectIntroModel(Int32 Ref) in C:\Documents
and Settings\David\Mijn documenten\Visual Studio Projects\T
Site\DataAccess\ModelDalc.vb:234


I'n confused. When I leave the 'where' part, it works fine.
Any ideas?

Regards,

Freek Versteijn
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top