T
Thomas Scheiderich
I get an error from trying to connect to my Sql6.5 server (which is why
I am using Ole). It says the server doesn't exist or the password is
wrong. I can't understand that because I use essetially the same
connection scripts on my ASP pages and it works fine.
Here is my ASP connection that works fine:
*****************************************************************
Set connectionToDatabase=Server.CreateObject("ADODB.Connection")
connectionToDatabase.ConnectionTimeout = 60
connectionToDatabase.Open "Provider=sqloledb;data source=steg;" & _
"initial catalog=travdata;" & _
"user id=sa;password="
*****************************************************************
Here is my aspx page (essentially):
*****************************************************************
<%@ Page Explicit="True" Language="VB" Debug="True" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<script runat="server">
Dim ConnectString, SelectStatement As String
Dim Connect As OleDbConnection = New OleDbConnection
Dim Adapter As OledbDataAdapter = New OleDbDataAdapter
Dim CmdBuilder As OleDbCommandBuilder
Dim ds As DataSet = New DataSet
Dim Row As DataRow
Sub Page_Load(Sender As Object, E As EventArgs)
If Not IsPostBack Then
SelectStatement = "Select * From carriers"
ConnectString = "Provider=SQLOLEDB;Data Source=steg;Initial
Catalog=travdata;uid=sa;pwd="
Connect.ConnectionString = ConnectString
Adapter.SelectCommand = _
new OleDbCommand(SelectStatement, Connect)
CmdBuilder = New OleDbCommandBuilder(Adapter)
Adapter.Fill(ds,"carriers")
end if
end sub
</script>
*****************************************************************
The error I get is:
*****************************************************************
Server Error in '/' Application.
--------------------------------------------------------------------------------
[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or
access denied.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException:
[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or
access denied.
Source Error:
Line 41: new OleDbCommand(SelectStatement, Connect)
Line 42: CmdBuilder = New OleDbCommandBuilder(Adapter)
Line 43: Adapter.Fill(ds,"carriers")
Line 44: end if
Line 45: end sub
Source File: c:\inetpub\wwwroot\itineraryTS.aspx Line: 43
Stack Trace:
[OleDbException (0x80004005): [DBNETLIB][ConnectionOpen (Connect()).]SQL
Server does not exist or access denied.]
System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) +20
System.Data.OleDb.OleDbConnection.InitializeProvider() +57
System.Data.OleDb.OleDbConnection.Open() +203
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection,
ConnectionState& originalState) +44
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String
srcTable) +36
ASP.itineraryTS_aspx.Page_Load(Object Sender, EventArgs E) in
c:\inetpub\wwwroot\itineraryTS.aspx:43
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
*****************************************************************
I know the server exists and so does the access. What am I missing?
Thanks,
Tom.
I am using Ole). It says the server doesn't exist or the password is
wrong. I can't understand that because I use essetially the same
connection scripts on my ASP pages and it works fine.
Here is my ASP connection that works fine:
*****************************************************************
Set connectionToDatabase=Server.CreateObject("ADODB.Connection")
connectionToDatabase.ConnectionTimeout = 60
connectionToDatabase.Open "Provider=sqloledb;data source=steg;" & _
"initial catalog=travdata;" & _
"user id=sa;password="
*****************************************************************
Here is my aspx page (essentially):
*****************************************************************
<%@ Page Explicit="True" Language="VB" Debug="True" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<script runat="server">
Dim ConnectString, SelectStatement As String
Dim Connect As OleDbConnection = New OleDbConnection
Dim Adapter As OledbDataAdapter = New OleDbDataAdapter
Dim CmdBuilder As OleDbCommandBuilder
Dim ds As DataSet = New DataSet
Dim Row As DataRow
Sub Page_Load(Sender As Object, E As EventArgs)
If Not IsPostBack Then
SelectStatement = "Select * From carriers"
ConnectString = "Provider=SQLOLEDB;Data Source=steg;Initial
Catalog=travdata;uid=sa;pwd="
Connect.ConnectionString = ConnectString
Adapter.SelectCommand = _
new OleDbCommand(SelectStatement, Connect)
CmdBuilder = New OleDbCommandBuilder(Adapter)
Adapter.Fill(ds,"carriers")
end if
end sub
</script>
*****************************************************************
The error I get is:
*****************************************************************
Server Error in '/' Application.
--------------------------------------------------------------------------------
[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or
access denied.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException:
[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or
access denied.
Source Error:
Line 41: new OleDbCommand(SelectStatement, Connect)
Line 42: CmdBuilder = New OleDbCommandBuilder(Adapter)
Line 43: Adapter.Fill(ds,"carriers")
Line 44: end if
Line 45: end sub
Source File: c:\inetpub\wwwroot\itineraryTS.aspx Line: 43
Stack Trace:
[OleDbException (0x80004005): [DBNETLIB][ConnectionOpen (Connect()).]SQL
Server does not exist or access denied.]
System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) +20
System.Data.OleDb.OleDbConnection.InitializeProvider() +57
System.Data.OleDb.OleDbConnection.Open() +203
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection,
ConnectionState& originalState) +44
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String
srcTable) +36
ASP.itineraryTS_aspx.Page_Load(Object Sender, EventArgs E) in
c:\inetpub\wwwroot\itineraryTS.aspx:43
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
*****************************************************************
I know the server exists and so does the access. What am I missing?
Thanks,
Tom.