SQL logon: aspx fails, winform ok

A

adam

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
Security=False;
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.

adam

1]
Public Sub runQuery(ByVal con As IDbConnection, ByVal cmd As
IDbCommand)
Try
m_output.Text = ""
con.ConnectionString = m_con.Text
cmd.CommandText = m_sql.Text
cmd.Connection = con
con.Open()
Dim o As Object = cmd.ExecuteScalar()
m_output.Text = o.ToString()
con.Close()
Catch ex As Exception
m_output.Text = ex.GetType().Name + vbCrLf + ex.Message
End Try
End Sub
 
C

Carl Prothman [MVP]

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

Adam,
There can be serveral resons why you are getting that error message..
Check out the following Microsoft KB article for solutions
http://support.microsoft.com/default.aspx?scid=kb;en-us;328306

--

Thanks,
Carl Prothman
Microsoft ASP.NET MVP

Hire top-notch developers at
http://www.able-consulting.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top