D
Don Albertson
Running SQLServer 2000 Developer Edition on Win2K Professional PC
The quickstart tutorial materials are trying to use SqlConnection
objects and fail.
When I modify them to use OleDbConnection objects there is no problem.
Here is the simplest code I can come up with that demonstrates the
situation:
========================Example that works=============================
Dim m_ConnectStr As String = "Provider=SQLOLEDB.1;Integrated
Security=SSPI;Persist Security Info=True;Initial Catalog=pubs;Data
Source=MY_PC;Use Procedure for Prepare=1;Auto Translate=True;Packet
Size=4096;Workstation ID=MY_PC;Use Encryption for Data=False;Tag with
column collation when possible=False"
Dim MyConnection As System.Data.OleDb.OleDbConnection
MyConnection = New System.Data.OleDb.OleDbConnection(m_ConnectStr)
MyConnection.Open()
'Do stuff with MyConnection
MyConnection.Close()
========================Example that fails=============================
Dim m_ConnectStr As String =
"server=(local)\NetSDK;database=pubs;Trusted_Connection=yes"
Dim MyConnection As SqlConnection
MyConnection = New SqlConnection(m_ConnectStr)
MyConnection.Open()
Error message is:
System.Data.SqlClient.SqlException: SQL Server does not exist or access
denied.
Figuring that the \NetSDK might not be quite right, I modified the
connection string slightly and got this
========================Different Example that fails===================
Dim m_ConnectStr As String =
"server=MY_PC;database=pubs;Trusted_Connection=yes"
Dim MyConnection As SqlConnection
MyConnection = New SqlConnection(m_ConnectStr)
MyConnection.Open()
Error Message is:
System.Security.SecurityException: Requested registry access is not allowed.
Anyone got a clue? I'm running short.
The quickstart tutorial materials are trying to use SqlConnection
objects and fail.
When I modify them to use OleDbConnection objects there is no problem.
Here is the simplest code I can come up with that demonstrates the
situation:
========================Example that works=============================
Dim m_ConnectStr As String = "Provider=SQLOLEDB.1;Integrated
Security=SSPI;Persist Security Info=True;Initial Catalog=pubs;Data
Source=MY_PC;Use Procedure for Prepare=1;Auto Translate=True;Packet
Size=4096;Workstation ID=MY_PC;Use Encryption for Data=False;Tag with
column collation when possible=False"
Dim MyConnection As System.Data.OleDb.OleDbConnection
MyConnection = New System.Data.OleDb.OleDbConnection(m_ConnectStr)
MyConnection.Open()
'Do stuff with MyConnection
MyConnection.Close()
========================Example that fails=============================
Dim m_ConnectStr As String =
"server=(local)\NetSDK;database=pubs;Trusted_Connection=yes"
Dim MyConnection As SqlConnection
MyConnection = New SqlConnection(m_ConnectStr)
MyConnection.Open()
Error message is:
System.Data.SqlClient.SqlException: SQL Server does not exist or access
denied.
Figuring that the \NetSDK might not be quite right, I modified the
connection string slightly and got this
========================Different Example that fails===================
Dim m_ConnectStr As String =
"server=MY_PC;database=pubs;Trusted_Connection=yes"
Dim MyConnection As SqlConnection
MyConnection = New SqlConnection(m_ConnectStr)
MyConnection.Open()
Error Message is:
System.Security.SecurityException: Requested registry access is not allowed.
Anyone got a clue? I'm running short.