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
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