Question

I found this example but am completely new to this and so it is too advanced for me... I understand what's going on in the view, but how and where am I supposed to actually connect to the database, with a username and password and all? What should my connectionString be in Web.config? What is "NorthwindConnectionString"?

Was it helpful?

Solution 2

This link actually helped me out a lot. I wasn't trying to connect to an ODBC database, but I didn't know that there was a wizard that would walk me through the steps! It figured everything out for me.

OTHER TIPS

The NorthwindConnectionString in the sample you linked to is configured in the Web.config. The following MSDN documentation should help you step through connecting to a SQLDataSource, see

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.sqldatasource.connectionstring.aspx

As noted in the above link, the Connection String is added to the <connectionStrings> node of the Web.config. This connection string holds you database credentials.

Example

<connectionStrings>
  <add name="MyNorthwind" connectionString="server=foehammer;database=Northwind;user=north;password=north;" providerName="System.Data.SqlClient" />
</connectionStrings>

Hope this helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top