Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VS Crashes When Creating Business Object
Message
 
To
02/03/2006 16:31:54
Donald Lowrey
Data Technology Corporation
Las Vegas, Nevada, United States
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Environment versions
Environment:
C# 2.0
OS:
Windows XP SP2
Database:
MS SQL Server
Miscellaneous
Thread ID:
01101084
Message ID:
01101465
Views:
11
Don,

>These two (2) connection strings used in app.config yield the same error reported above:
>
>
><add key="maindata\Connection" value="server=(local);Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Northwind" />
>
><add key="Northwind\Connection" value="server=(local);uid=sa;pwd=;database=NorthWind;" />
>
Sorry to hear about your frustration with connection strings! In the settings you listed above, "maindata" is listed as the database key in the first example and "Northwind" in the second. This first part of the string is your database key which must match the value you have specified in ABusinessObject.DatabaseKey.

For example, ABusinesssObject.DatabaseKey is set to "Northwind" like this:
public class ABusinessObject : mmBusinessObject
{
	/// <summary>
	/// Constructor
	/// </summary>
	public ABusinessObject()
	{
		this.DatabaseKey = "Northwind";
		this.RetrieveAutoIncrementPK = true;
	}
}
Then your app.config connection key must be set to "Northwind" like this:
<add key="Northwind\Connection" value="server=(local);uid=sa;pwd=;database=NorthWind;" />
If all of this is set up properly and you still can't connect, you can copy the connection string from a data connection in Solution Explorer. For example:

  1. Open the Visual Studio Solution Explorer by selecting View | Solution Explorer from the menu.

  2. In the Choose Data Source dialog, select the Data source and Data provider

  3. Click the Continue button. In the Add Connection dialog, specify the Server name, either Windows Authentication or SQL Server Authentication and select a database to connect to.

  4. Click the Test Connection button to make sure your connection is set up properly. When your test connection succeeds, click OK to close the dialog.

  5. In the Solution Explorer, your new connection should appear under Data Connections. Select the new data connection by clicking on it. Go to the Properties Window (if it's not visible, select View | Properties Window from the Visual Studio menu. In the Properties Window, double-click the Connection property shown on the left side of the Properties Window. This selects the entire connection string on the right.

  6. Press Ctrl+C to copy the connection string into the paste buffer, then go to your configuration file and paste this in as the value of your connection string. Note: If the string contains any double quotes, simply remove them.


Best Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform