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.SqlClient.SqlException: SQL Server does not exist or access denied.
Source Error:
Line 17: sqladapt.SelectCommand = sqlcom
Line 18: dsdata.Clear()
Line 19: sqladapt.Fill(dsdata, "data")
Line 20: End Sub
Line 21:
Source File: \\Coreabil\coreabil\coresql.
vb Line: 19
Stack Trace:
[SqlException: SQL Server does not exist or access denied.]
System.Data.SqlClient.ConnectionPool.GetConnection (Boolean& isInTransaction) +472
System.Data.SqlClient.SqlConnectionPoolManager.Get PooledConnection(SqlConnectionString options, Boolean& isInTransaction) +372
System.Data.SqlClient.SqlConnection.Open() +384
System.Data.Common.DbDataAdapter.QuietOpen(IDbConn ection connection, ConnectionState& originalState) +44
System.Data.Common.DbDataAdapter.FillFromCommand(O bject 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
coreabil.coresql.getdata(Object strquery) in \\Coreabil\coreabil\coresql.
vb:19
coreabil.studentform.Page_Load(Object sender, EventArgs e) in \\Coreabil\coreabil\studentform.aspx.
vb:83
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
WebConfig File
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<!-- DYNAMIC DEBUG COMPILATION
Set compilation debug="true" to insert debugging symbols (.pdb information)
into the compiled page. Because this creates a larger file that executes
more slowly, you should set this value to true only when debugging and to
false at all other times. For more information, refer to the documentation about
debugging ASP.NET files.
-->
<compilation defaultLanguage="
vb" debug="true" />
<!-- CUSTOM ERROR MESSAGES
Set customErrors mode="On" or "RemoteOnly" to enable custom error messages, "Off" to disable.
Add <error> tags for each of the errors you want to handle.
-->
<customErrors mode="Off"/>
<!-- AUTHENTICATION
This section sets the authentication policies of the application. Possible modes are "Windows",
"Forms", "Passport" and "None"
-->
<authentication mode="Windows" />
<!-- AUTHORIZATION
This section sets the authorization policies of the application. You can allow or deny access
to application resources by user or role. Wildcards: "*" mean everyone, "?" means anonymous
(unauthenticated) users.
-->
<authorization>
<allow users="*" />
<!-- <allow users="[comma separated list of users]"
roles="[comma separated list of roles]"/>
<deny users="[comma separated list of users]"
roles="[comma separated list of roles]"/>
-->
</authorization>
<!-- APPLICATION-LEVEL TRACE LOGGING
Application-level tracing enables trace log output for every page within an application.
Set trace enabled="true" to enable application trace logging. If pageOutput="true", the
trace information will be displayed at the bottom of each page. Otherwise, you can view the
application trace log by browsing the "trace.axd" page from your web application
root.
-->
<trace enabled="false" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true" />
<!-- SESSION STATE SETTINGS
By default ASP.NET uses cookies to identify which requests belong to a particular session.
If cookies are not available, a session can be tracked by adding a session identifier to the URL.
To disable cookies, set sessionState cookieless="true".
-->
<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;user id=sa;password="
cookieless="false"
timeout="20"
/>
<!-- GLOBALIZATION
This section sets the globalization settings of the application.
-->
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />
</system.web>
</configuration>
CoreSQL File
Module coresql
'Dataset dsdata is used to pass data to forms from the database
Public dsdata As New DataSet
Dim strquery As String
Public strresult As String
'getdata gets data from the database
'getdata(query string)
Public Sub getdata(ByVal strquery)
Dim sqlconn As New SqlClient.SqlConnection
Dim sqlcom As New SqlClient.SqlCommand
Dim sqladapt As New SqlClient.SqlDataAdapter
sqlconn.ConnectionString = "User ID=" & config.strdbuser & ";Initial Catalog=" & config.strdbname & ";Data Source=" & config.strdbip & ";Password=" & config.strdbpass
sqlcom.Connection = sqlconn
sqlcom.CommandText = strquery
sqladapt.SelectCommand = sqlcom
dsdata.Clear()
sqladapt.Fill(dsdata, "data")
End Sub
'updatedata updates the database or deletes records
'updatedata(query string)
Public Sub updatedata(ByVal strquery)
Dim sqlconn As New SqlClient.SqlConnection
Dim sqlcom As New SqlClient.SqlCommand
strresult = ""
sqlconn.ConnectionString = "User ID=" & config.strdbuser & ";Initial Catalog=" & config.strdbname & ";Data Source=" & config.strdbip & ";Password=" & config.strdbpass
sqlcom.Connection = sqlconn
sqlcom.CommandText = strquery
sqlcom.Connection.Open()
Try
sqlcom.ExecuteNonQuery()
strresult += "Good"
Catch
strresult += ";Failed" & Err.Description & ";"
End Try
sqlcom.Connection.Close()
End Sub
End Module
Config File
Module config
'Coreabilities Web Self Assessment Configuration File
'All options should be put in quotes
'Section 1: Database Access
'These are the database settings
'Database Server IP or NetBIOS Name
Public strdbip As String = "localhost"
'Database Server Initial Database Name
Public strdbname As String = "coreabil"
'Database Server Username
Public strdbuser As String = "coreabil"
'Database Server Password
Public strdbpass As String = "sorry"
'Section 2: Administrator Access
'Administrator Password
Public stradminpass As String = "sorry"
End Module
jd erd