sydneyguy
asked on
getting an aspx page to access a sqlserver data base
am running this code but is throwing up an error
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
have been through to
Enable remote connections for SQL Server 2005 Express or SQL Server 2005 Developer Edition
and
Enable the SQL Server Browser service
but still gives me an error
Response.Write("sql update")
Dim MyConnection As SqlConnection
MyConnection = New SqlConnection("server=(PER -148\SQLEX PRESS)\;da tabase=Tec hKnowBaseS QL;Trusted _Connectio n=yes")
Dim DS As DataSet
Dim MyCommand As SqlDataAdapter
MySql = "SELECT SearchName FROM tblsearchname"
MyCommand = New SqlDataAdapter(MySql & "ORDER BY SearchName", MyConnection)
Try
DS = New DataSet()
MyCommand.Fill(DS, "tblsearchname")
MyDataGrid.DataSource = DS.Tables("tblsearchname") .DefaultVi ew
MyDataGrid.DataBind()
Catch
ErrBox.Text = "Err 1005 xxxxxzzz Could not Update Data Grid Check if SQL DataBase Operational"
End Try
MyConnection.Close()
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
have been through to
Enable remote connections for SQL Server 2005 Express or SQL Server 2005 Developer Edition
and
Enable the SQL Server Browser service
but still gives me an error
Response.Write("sql update")
Dim MyConnection As SqlConnection
MyConnection = New SqlConnection("server=(PER
Dim DS As DataSet
Dim MyCommand As SqlDataAdapter
MySql = "SELECT SearchName FROM tblsearchname"
MyCommand = New SqlDataAdapter(MySql & "ORDER BY SearchName", MyConnection)
Try
DS = New DataSet()
MyCommand.Fill(DS, "tblsearchname")
MyDataGrid.DataSource = DS.Tables("tblsearchname")
MyDataGrid.DataBind()
Catch
ErrBox.Text = "Err 1005 xxxxxzzz Could not Update Data Grid Check if SQL DataBase Operational"
End Try
MyConnection.Close()
ASKER
have set up the un and password for techknowbase but how do i check using ssms please to check that its workign ok
ASKER
new connection string
MyConnection = New SqlConnection("server=(PER -148\SQLEX PRESS)\;da tabase=Tec hKnowBaseS QL; User Id=admin; password=admin1") ''admin admin1
MyConnection = New SqlConnection("server=(PER
>how do i check using ssms
Start SSMS from any workstation
Click the Options button
On the login tab
Enter Server name: PER-148\SQLEXPRESS
Choose SQL Authentication
Enter Userid and Password that you setup
On the Connection Propeties tab
Enter the database name
Click the Connect button
Do you connect?
Start SSMS from any workstation
Click the Options button
On the login tab
Enter Server name: PER-148\SQLEXPRESS
Choose SQL Authentication
Enter Userid and Password that you setup
On the Connection Propeties tab
Enter the database name
Click the Connect button
Do you connect?
ASKER
have ssms (sql server management studio )
weres the options button please
weres the options button please
ASKER
ok found the login in form the main connection rgt click have tested it and set it up and it works fine
ASKER
but when i go to acceess the tables it throws up the below error see image
error.png
error.png
ASKER
still throws up
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
ASKER
its a log in issue but cannot see what it is
Because you can see the Object Explorer tells me that your login is connecting to the server. The next step is to diagnose why you are having difficulty accessing the database.
1. On the above screen shot, click the User Mapping page (on the right side) to see what database are mapped
2. Also, under databases on the left side, expand security, then users to see what users are defined for the TechKnowBaseSQL database.
1. On the above screen shot, click the User Mapping page (on the right side) to see what database are mapped
2. Also, under databases on the left side, expand security, then users to see what users are defined for the TechKnowBaseSQL database.
ASKER
login in through ssms using admin admin1 as un and pw and it worked fine use a diff pw and it fials so thats workign ok
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks for you help up and running now
Often in this scenario, you want to go like this. Enable SQL authentication. Create an SQL Server login dedicated to your ASP site and give it the necessary permissions for the TechKnowBaseSQL database. Make sure you can login from SSMS using that login. Change your connection string from Trusted connection to one with UID and PWD.