Friday, March 30, 2012

MSDE SQL Connection String error

Hi;
Installed MSDE on computer by running:

c:setup INSTANCENAME="VSdotNET" SAPWD="PASSWORD" SECURITYMODE=SQL

REBOOTED AND sql SERVER iCON APPEARS on the lower desktop Icon bar, open it and it says:
Server: JOHN Servises: SQL Server Running \\JOHN - MSSQLServer

opened a command prompt at c: and
entered osql -S JOHN -U sa -P password
and got the 1> reply on the next line

I typed EXIT

I had downloaded two scripts that create Pubs and Northwind SQL databases. I put them in the C: folder

I Typed at c:osql -E -i instpubs.sql

It created the pubs SQL database for me

I Typed at c:osql -E -i instnwinds.sql

It created the nwinds SQL database for me

I closed the command prompt and
went to the Administrator Tools in the Control Panel
I selected Data OLEDB Selected ADD entered Pubs and used default values for Pubs to create a connection Tested it OK

Then went and ran Visual Studio Net 2003
Checked to see if the pubs and northwind SQL databases where present in the Server Explorer drop down window.
I seleced the connect to database Icon and in it's Data Link Properties
I entered JOHN for server name
pubs for selected database on the server
with Provider as MS OLEDB for SQL Service
the Icon changed to connected.

I entered this in the code for page_load


Dim MyDS As New DataSet
Dim ConnStr As String
Dim SQL As String
ConnStr = "server=(local)C:\Program Files\Microsoft SQL Server\MSSQL\Data;database=pubs;Trusted_Connection=yes"

SQL = "SELECT * FROM Titles " & _
"SELECT * FROM Publishers"
Dim MySqlConn As New SqlConnection(ConnStr)
Dim MySqlAdapter As New SqlDataAdapter(SQL, ConnStr)

'The SqlDataAdapter will automatically open and
'close the SqlConnection
MySqlAdapter.Fill(MyDS)


But I can not get this to work it errors out on line:

MySQLAdapter.Fill(myDS)

with: [SqlException (0x80131904): Unknown ProviderError Locating Server/Instance Specified ]
System.Data.ProviderBase.DbConnectionPool.GetConnection(Object owningObject) +317

I change ConnStr to this:


ConnStr = "server=(local)\data;database=pubs; uid=sa; Pwd=password" & _
"Trusted_Connection=true"

and get this error:
[SqlException (0x80131904): Shared Memory Provider: The system cannot find the file specified.
]
System.Data.ProviderBase.DbConnectionPool.GetConnection(Object owningObject) +317

I've tried so many combination with and without user and password, I just don't get it, spent three long days stuck here, can someone help me out.

Note:
C:\Program Files\Microsoft SQL Server\MSSQL\Data
Is the accual location on my machine that pubs database is located.

I can use the pubs SQL database in Web Matrix OK.
Thanks
pdqjohnny@.hotmail.comHi;
Well I went back to VS and used the Drag/Drop from the Server Explorer DataConnections window to get a SQL Connection on my form. I then looked at the properties and copied the connection property in created for me.

ConnStr = "workstation id=JOHN;packet size=4096;integrated security=SSPI;data source=JOHN;persist security info=False;initial catalog=pubs"

and then cut/replace my old Connstr shown above with it.

Now I get this ERROR:

SELECT permission denied on object 'titles', database 'pubs', owner 'dbo'.
SELECT permission denied on object 'publishers', database 'pubs', owner 'dbo'.

Can anybody help?
Thanks
John|||OK
I continued with my search and found someone mention this link for program called
Microsoft SQL Server Web Data Administrator (for MSDE or IIS)
http://asp.net/Projects/Cassini/Download/Default.aspx?tabindex=0&tabid=1

I downloaded and installed it then ran it.

I found that my Server=John\ASPNET was not assigned to the pubs database (I THINK)

so I Selected: IIS, Start, Windows Integated, server Roles
then I picked the top entry Sytem Administrators, there ar about 8 rows shown here
then to the far right in it's row was:
Add or Edit Logins
so I click on them I new window opened.
It showed Available Login: names in the left window where
"John\ASPNET and sa"
So I moved all of them to the right to the Assigned logins: window
and clicked Done.
I exited out of this program and went back to VS 2003 to my program mention above.
I changed the ConnStr to this:


ConnStr = "server=JOHN;database=pubs;uid=sa;" & _
"Trusted_Connection=true"

Ok it runs nowsql

No comments:

Post a Comment