By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,290 Members | 1,439 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,290 IT Pros & Developers. It's quick & easy.

SQL logon: aspx fails, winform ok

P: n/a
On Thursday it was working, then something changed and now I can't
access my sql server database from aspx :(

I have simplified my code to a simple connect and query [1] where m_sql,
m_con are text boxes and m_output is a label. It fails when I pass in
either Sql#### or OleDB#### connection and command objects.

Connection strings
Ole Db: Provider=SQLOLEDB;Initial Catalog=dbName;Server=MACHINE;User ID=sa;
Sql : Initial Catalog=dbName;Server=MACHINE;User ID=sa;Integrated
OleDb error : OleDbException [DBNETLIB][ConnectionOpen
(Connect()).]SQL Server does not exist or access denied. Invalid
connection string attribute
Sql Error : {System.Data.SqlClient.SqlError}
Class: 20
LineNumber: 0
Message: "SQL Server does not exist or access denied."
Number: 17
Procedure: "ConnectionOpen (Connect())."
Server: ""
Source: ".Net SqlClient Data Provider"
State: 0

This same code runs ok as a win form under my own account. The simple
project runs fine from some other machines but not all. Aspx runs as
<MACHINE>\IUSR_<MACHINE>. I do not remember making and security changes
but obviously must have done.

I assume that there is some sort of security setting somewhere. I am
using the sa account in the demo with no password.

Any hints appreciated.


Public Sub runQuery(ByVal con As IDbConnection, ByVal cmd As
m_output.Text = ""
con.ConnectionString = m_con.Text
cmd.CommandText = m_sql.Text
cmd.Connection = con
Dim o As Object = cmd.ExecuteScalar()
m_output.Text = o.ToString()
Catch ex As Exception
m_output.Text = ex.GetType().Name + vbCrLf + ex.Message
End Try
End Sub
Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
adam wrote:
Sql Error : {System.Data.SqlClient.SqlError}
Message: "SQL Server does not exist or access denied."
Procedure: "ConnectionOpen (Connect())."
Source: ".Net SqlClient Data Provider"

There can be serveral resons why you are getting that error message..
Check out the following Microsoft KB article for solutions;en-us;328306


Carl Prothman
Microsoft ASP.NET MVP

Hire top-notch developers at
Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.