...

View Full Version : .Net - SQL Server does not exist or access denied



gtsikes
07-27-2004, 05:38 PM
Greetings,

When I try to use the .Net data provider namespace System.Data.SqlClient on my ASP.Net pages. I get the error
SQL Server does not exist or access denied. If I change my code to use System.Data.ODBC and use the corresponding Object model for ODBC, my pages work great. I have an SQL2000 server with SP3 running on my corporate WAN and a seperate Web server with the 1.1 framework. All ASP pages work fine using ADO and ODBC or SQLOLEDB, but ASP.Net only works with ODBC. I would like to eliminate the ODBC layer. I have tried using integrated security and SQL authenication. Any ideas?

This would be a typical snippet for a datagrid's databinding.


sub BindData()
Dim connectionString As String = "server='UWQJAXCNV01'; trusted_connection=true; database='ucd'"
Dim dbConnection As System.Data.IDbConnection = New System.Data.SqlClient.SqlConnection(connectionString)
Dim queryString As String = "SELECT * FROM jerry.customer"
Dim dbCommand As System.Data.IDbCommand = New System.Data.SqlClient.SqlCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection
Dim dataAdapter As System.Data.IDbDataAdapter = New System.Data.SqlClient.SqlDataAdapter
dataAdapter.SelectCommand = dbCommand
Dim dataSet As System.Data.DataSet = New System.Data.DataSet("Cust_List")
dataAdapter.Fill(dataSet)
DataGrid1.datasource = _
dataSet.Tables("Cust_List").Defaultview
DataGrid1.databind
end sub


Thanks,

Jerry

allida77
07-27-2004, 06:18 PM
Since you are using a trusted connection be sure the ASPNET account has rights to that database.

gtsikes
07-27-2004, 08:47 PM
From what I have read, the ASPNET account can be used if the Web server and the SQL server are on the same box. ASPNET is a local user only.

seigo
07-30-2004, 09:00 PM
use user=user;pwd=password in sql connection string instead of trusted_connection=yes



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum