brassmonkeyboy
asked on
Selecting The Database to Use in ASP.NET code...
This should be an easy one. I've learned how to use ASP.NET to modify the Northwind Database. Now, I want to write a page to modify a DIFFERENT database, but I don't know how to identify it.
You see, in the ASP.NET code, Northwind is identified as "NWind". Nowhere in the database's information or properties am I able to find this name. I need to use the same-level of name for my new database, but I don't know what name that would be. How do I find out?
You see, in the ASP.NET code, Northwind is identified as "NWind". Nowhere in the database's information or properties am I able to find this name. I need to use the same-level of name for my new database, but I don't know what name that would be. How do I find out?
ASKER
Hrm..I don't think I was as clear as I should have been. I have connected to it fine through the Server Explorer (It's sql btw).
The code I've been using to access the Northwind database in code is like this:
Dim strConnection As String = ConfigurationSettings.AppS ettings("N Wind")
Now, I just want to use this to connect to my db instead of Northwind. But I can't find a single occurance of the name "NWind" so I can figure out just how to identify my new database. What does the "NWind" refer to precisely?
The code I've been using to access the Northwind database in code is like this:
Dim strConnection As String = ConfigurationSettings.AppS
Now, I just want to use this to connect to my db instead of Northwind. But I can't find a single occurance of the name "NWind" so I can figure out just how to identify my new database. What does the "NWind" refer to precisely?
My only guess is that it could be a DSN . . .
Control Panel, Admin Tools, Data Sources (ODBC)
See if it is listed in there.
So you are saying you want to replace your database name with NWind?
ConfigurationSettings.AppS ettings("Y ourDatabas eName")
Control Panel, Admin Tools, Data Sources (ODBC)
See if it is listed in there.
So you are saying you want to replace your database name with NWind?
ConfigurationSettings.AppS
ASKER
Nothing's listed in the DSN list at all...
Yeah, I want to do this:
ConfigurationSettings.AppS ettings("Y ourDatabas eName")
But I don't know what exactly to put in for "YourDatabaseName" because I don't know the source of the NWind name.
Yeah, I want to do this:
ConfigurationSettings.AppS
But I don't know what exactly to put in for "YourDatabaseName" because I don't know the source of the NWind name.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can use the Server Explorer (above the toolbox on the left)
in Visual Studio to access databases that are local or on another server.
Or you can access the new database in Code like this:
This example uses SQL Server:
ConnectionString ="server=localhost;Initial
Dim connection As New SqlConnection(ConnectionSt
Dim command As New SqlCommand("GetCatInDept",
command.CommandType = CommandType.StoredProcedur
command.Parameters.Add("@D
command.Parameters("@Depar
Try
connection.Open()
Return command.ExecuteReader(Comm
Catch e As Exception
connection.Close()
Throw e
End Try