|
-
Mar 25th, 2004, 06:32 AM
#1
Thread Starter
Lively Member
DB Connectivity with SQL Server using SqlClient
DB Connectivity with SQL Server using SqlClient : [IIS and DB are on different machines.]
<%@ Page Language="VB" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>
<script runat="server">
Sub Page_Load(sender As Object, e As EventArgs)
Dim myConnectionString As String = "Server=IP Address of DB Server;Database=DB Name;User ID=uname;Password=pwd;Integrated Security=SSPI"
Dim myConnection As New SqlConnection(myConnectionString)
Dim cmdTest As SqlCommand
Dim rdrTest As SqlDataReader
myConnection.Open()
cmdTest = New SqlCommand ("select * from tblAdmin")
rdrTest = cmdTest.ExecuteReader
gridTest.DataSource = rdrTest
gridTest.DataBind
rdrTest.Close
cmdTest.Dispose
myConnection.Close
End Sub
Errors occurred :
[SqlException: ƒ†[ƒU[ 'DB Server\Guest' ‚̓ƒOƒCƒ“‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½B]
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) +472
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) +372
System.Data.SqlClient.SqlConnection.Open() +384
ASP.test_sqlclient_sqlserver_aspx.Page_Load(Object sender, EventArgs e) +43
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
Please kindly suggest some solution
Regards
Mahesh
Everybody is always learning something new ! 
-
Mar 25th, 2004, 02:13 PM
#2
Frenzied Member
You can't have IIS and the SQL DB on different machines and use Integrated Security.
http://msdn.microsoft.com/library/de...pplication.asp
Accessing SQL Server from a Web Application
Use Windows integrated security. This option passes the user's credentials to SQL Server. Because of delegation issues, this is practical primarily if SQL Server is on the same computer as IIS and your users must be on the same domain as the Web server computer.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|