I'm using the ODBC class to connect to a SQL Server db with the DAAB. I have a stored proc that takes one int parameter. I'm adding an "in" parameter and calling ExecuteReader. The command object shows the parameter in the debugger, but an exception is
raised ("Procedure x expects parameter x, which was not supplied.") and the SQL Profiler shows that the parameter isn't being passed. Here's the code (I've genericized some names):
Public Function TransferFile(ByVal myParam As Long) As Integer
Dim db As Database = DatabaseFactory.CreateDatabase("myDB")
Dim cmd As DbCommand = db.GetStoredProcCommand("mySP")
db.AddInParameter(cmd, "@myParam", DbType.Int32, myParam)
Dim rdr As OdbcDataReader = db.ExecuteReader(cmd)
My connection strings are in web.config, and they seem to be working fine, but I'll include them here.
On a side note, all it seems I need, as far as config files go, is web.config. I'm a bit confused about what I'd need ConnectionSettings.config or dataConfiguration.config for.
I recommend that you don't use the ODBC drvier for SQL Server and instead use the Native SqlClient Driver.
The error has nothing to do with the DAAB. The code you have won't work with the ODBC Driver.
Look at the examples here:
The configuration information in app.config tells the DatabaseFactory.CreateDatabase() method the database you are connecting to and the database class to use to connect to that database.
Check the documentation and the quickstarts for examples. I have a tutorial here that may help:
and all of my Enterprise Library 2.0 Tutorials here:
Microsoft MVP C#