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"?

有帮助吗?

解决方案 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.

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top