Showing posts with label websites. Show all posts
Showing posts with label websites. Show all posts

Monday, March 12, 2012

new on asp.net 2.0 trying to figure out how to connect to a database

Right now I'm just looking at websites how to create a database and putting it in the App_Data folder which is no problem. What I want to do is Programmatically do it. in the example code that I see it says:

Dim ConnString as string = ConfigurationManager.ConnectionStrings(connStringName).ConnectionString

or

Dim MyConnString as new sqlconnection = New SqlConnection(ConfigurationManager.ConnectionStrings(connStringName).ConnectionString)

now every time I put the connStringName in the parenthasis it tells me that its an error: Name connstringName is not declared.

I figure the connstringName is the name in the connectionStrings in the web.config.

So I am doing something wrong here, I would appreciate any help.

Have a look athttp://www.asp.net/learn/videos/view.aspx?tabid=63&id=49

alsohttp://www.asp.net/learn/videos/view.aspx?tabid=63&id=110

and very concisely inhttp://quickstarts.asp.net/QuickStartv20/aspnet/doc/data/databases.aspx#connstrings

HTH