'set up connection
dim myConnection as new OleDbConnection("Provider=SQLOLEDB;Data Source=localhost;Initial Catalog=LearnASP_DB;Integrated Security=SSPI;Connect Timeout=30")'open connection
dim myCommand as new OleDbDataAdapter("select * from tblUsers",myConnection)'fill dataset
dim ds as DataSet = new DataSet()
myCommand.Fill(ds, "tblUsers")
And I'm getting the following error:
[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.
Can someone tell me what I'm doing wrong?
Thanks in advanceI am pretty sure you should use (local) instead of localhost for the Data Source.
Terri|||localhost calls the webserver. (local) is the correct syntax.
should also add that if you're using "Provider=SQLOLEDB;", you might as well use System.Data.SqlClient|||you said if I'm using Provider="SQLOLEDB" I migh as well use System.Data.SqlClient
What are my other choices for Provider?
And what the difference between OleDbConnection and SqlClient?
Thanks again|||SqlClient was made specifically as the namespace to use for SqlServer. No "Provider" is needed.
http://able-consulting.com/dotnet/adonet/Data_Providers.htm#SQLClientManagedProvider|||thanks for you help :)
No comments:
Post a Comment