S
stephen
Hi,
I have Question on DAAB.
I created 2 connection parameters one for Development box and another For
Test box, when I tried to access them using this piece of code, I get an
error
Here's what I did:
in the dataConfiguration.config:
<instances>
<instance name="Database Instance" type="Sql Server"
connectionString="Development" />
<instance name="Database Instance" type="Sql Server"
connectionString="Test" />
</instances>
<connectionStrings>
<connectionString name="Development">
<parameters>
---Some parameters here---
</parameters>
</connectionString>
<connectionString name="Test">
<parameters>
---Some parameters here---
</parameters>
</connectionString>
</connectionStrings>
In the Code:
I tried this
Dim ds As DataSet =
DatabaseFactory.CreateDatabase("Development").ExecuteDataSet(CommandType.Text,
_
"SELECT * FROM Categories ORDER BY CategoryName")
It gave me an error....
but when I changed it to this
Dim ds As DataSet =
DatabaseFactory.CreateDatabase().ExecuteDataSet(CommandType.Text, _
"SELECT * FROM Categories ORDER BY CategoryName")
it worked fine...
I understand it takes the default value from the dataConfiguration.config
file but everytime i switch from Dev to Test i have to change the
connectionString in instance name to point appropriately...
can you please tell me how to avoid this?
Thanks,
Stephen
I have Question on DAAB.
I created 2 connection parameters one for Development box and another For
Test box, when I tried to access them using this piece of code, I get an
error
Here's what I did:
in the dataConfiguration.config:
<instances>
<instance name="Database Instance" type="Sql Server"
connectionString="Development" />
<instance name="Database Instance" type="Sql Server"
connectionString="Test" />
</instances>
<connectionStrings>
<connectionString name="Development">
<parameters>
---Some parameters here---
</parameters>
</connectionString>
<connectionString name="Test">
<parameters>
---Some parameters here---
</parameters>
</connectionString>
</connectionStrings>
In the Code:
I tried this
Dim ds As DataSet =
DatabaseFactory.CreateDatabase("Development").ExecuteDataSet(CommandType.Text,
_
"SELECT * FROM Categories ORDER BY CategoryName")
It gave me an error....
but when I changed it to this
Dim ds As DataSet =
DatabaseFactory.CreateDatabase().ExecuteDataSet(CommandType.Text, _
"SELECT * FROM Categories ORDER BY CategoryName")
it worked fine...
I understand it takes the default value from the dataConfiguration.config
file but everytime i switch from Dev to Test i have to change the
connectionString in instance name to point appropriately...
can you please tell me how to avoid this?
Thanks,
Stephen