S
Sparky Arbuckle
I am trying to connect to a SQL server that is on a different machine
in the building. I can view the contents in Enterprise Manager and
Query Analyzer. The problems arise when I try to connect to this
database from a web application. Apparently I need an actual login and
password on the SQL server for connecting from a web application. Is
this always the case or are there ways around this. If it means
anything, I am using Visual Studio .NET 2003 and have imported all
relevant (I believe so) namespaces for this to work.
Connection string:
<add key="SQLConnection" value="Data Source=ServerName;Initial
Catalog=DatabaseName />
Testing connectivity:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Try
Dim objSQLConn As New
SqlClient.SqlConnection(ConfigurationSettings.AppSettings("SQLConnection"))
objSQLConn.Open()
If objSQLConn.State = ConnectionState.Open Then
Label1.Text = "SQL Connection is open"
Else
Label1.Text = "SQL Connection is closed"
End If
Catch sqlxcp As SqlClient.SqlException
Label2.Text = sqlxcp.ToString
Label3.Text = sqlxcp.Message
Label4.Text = sqlxcp.Source
Label5.Text = sqlxcp.Number
Finally
End Try
End Sub
______________________
I can view the data just fine in VS .NET's dataset filler but when I go
to actually connect via web application I get a plethora of errors. Any
suggestions?
in the building. I can view the contents in Enterprise Manager and
Query Analyzer. The problems arise when I try to connect to this
database from a web application. Apparently I need an actual login and
password on the SQL server for connecting from a web application. Is
this always the case or are there ways around this. If it means
anything, I am using Visual Studio .NET 2003 and have imported all
relevant (I believe so) namespaces for this to work.
Connection string:
<add key="SQLConnection" value="Data Source=ServerName;Initial
Catalog=DatabaseName />
Testing connectivity:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Try
Dim objSQLConn As New
SqlClient.SqlConnection(ConfigurationSettings.AppSettings("SQLConnection"))
objSQLConn.Open()
If objSQLConn.State = ConnectionState.Open Then
Label1.Text = "SQL Connection is open"
Else
Label1.Text = "SQL Connection is closed"
End If
Catch sqlxcp As SqlClient.SqlException
Label2.Text = sqlxcp.ToString
Label3.Text = sqlxcp.Message
Label4.Text = sqlxcp.Source
Label5.Text = sqlxcp.Number
Finally
End Try
End Sub
______________________
I can view the data just fine in VS .NET's dataset filler but when I go
to actually connect via web application I get a plethora of errors. Any
suggestions?