Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Issues after upgrading to asp.net v2

Status
Not open for further replies.

nichols

Technical User
May 24, 2001
92
GB
I have just upgraded my webserver to asp.net version 2 and I am trying to learn the new coding structure. I have tried the following script:

"<html xmlns="<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<h2>Engineering system test insert page</h2>
<form id="form1" runat="server">
<div>
<asp:SqlDataSource ID="SqlDatasource1" runat="server"
ConnectionString="DataSource=.\SQLEXPRESS;
AttachDbFilename=|DataDirectory|\Engineering_sys.mdf;
Integrated Security=True;
User Instance="True"
ProviderName="system.Data.SqlClient"
SelectCommmand="SELECT [area_ID], [area_name] From [Area]">
</asp:SqldataSource>

<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False"
DatakeyNames="area_ID"
DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="area_ID" HeaderText"area_ID"
InsertVisible="False"
ReadOnly="True"
SortExpression="area_ID" />

<asp:BoundField DataField="area_name"
HeaderText"area_name"
SortExpression="area_name" />
</Columns>

</asp:GridView>
</div>
</form>
</body>
</html>





We are getting the following error screen which does not make any sense


Server Error in '/' Application.
--------------------------------------------------------------------------------

Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".


<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>


Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.


<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>


I have tried to make the above mentioned changes to our web.config file but it makes no difference apart from stopping the existing pages fail to work with the same error message.

Does anyone know what could be making this happen?
 
First thing I would do is run your application on localhost. When run locally on the webserver it should show you the error.

But... Check the 2 instances of HeaderText... there should be an "=" to set the value.

Also... Change capitalization from this "</asp:SqldataSource>" to "</asp:SqlDataSource>"... This object is probably the source of your troubles.

Senior Software Developer
 
I have made the corrections stated above with no joy.

I tried it on the local host and it gives me the following error:

Server Error in '/' Application.
--------------------------------------------------------------------------------

Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: The server tag is not well formed.

Source Error:


Line 10: <form id="form1" runat="server">
Line 11: <div>
Line 12: <asp:SqldataSource ID="SqlDatasource1" runat="server"
Line 13: ConnectionString="DataSource=.\SQLEXPRESS;
Line 14: AttachDbFilename=|DataDirectory|\Engineering_sys.mdf;


Source File: /aimia/Engineering/engineering_insert_test2.aspx Line: 12


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42


does this help anyone?

Cheers
Chris
 
Hi.
Looks like at least 1 missing end " , maybe more:
Code:
<form id="form1" runat="server">
   <div>
<asp:SqldataSource ID="SqlDatasource1" runat="server" 
ConnectionString="DataSource=.\SQLEXPRESS;[COLOR=red]"[/color]
AttachDbFilename=|DataDirectory|\Engineering_sys.mdf;

[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Use this:

Code:
Use this:

         <asp:SqlDataSource ID="SqlDatasource1" runat="server"  
        ConnectionString="DataSource=.\SQLEXPRESS; 
        AttachDbFilename=|DataDirectory|\Engineering_sys.mdf;
        Integrated Security=True;
        User Instance=True"
        ProviderName = "system.Data.SqlClient" 
        SelectCommand = "SELECT [area_ID], [area_name] From [Area]">
        </asp:SqlDataSource>


There were a number of errors in it.

Senior Software Developer
 
Cheers for that. I've now pasted that over my code however I'm now getting the following error:

Server Error in '/' Application.
--------------------------------------------------------------------------------

Unable to find the requested .Net Framework Data Provider. It may not be installed.
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.ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.]
System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName) +1372167
System.Web.UI.WebControls.SqlDataSource.GetDbProviderFactory() +63
System.Web.UI.WebControls.SqlDataSource.GetDbProviderFactorySecure() +19
System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +120
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +17
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +149
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70
System.Web.UI.WebControls.GridView.DataBind() +4
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +69
System.Web.UI.Control.EnsureChildControls() +87
System.Web.UI.Control.PreRenderRecursiveInternal() +41
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

Any ideas?

Cheers for your help so far guys
Chris
 
I'm not positive... but try removing the line that says ProviderName = "system.Data.SqlClient"

I don't know why that would be required with any sql object.

Usually I would do this in the code behind using a SqlConnection and SqlCommand with a SqlDataAdapter.Fill to populate a dataset... then bind the dataset to the datagrid. I understand that there may be some fancier ways in VS.NET 2005 that I'm trying to pick up on.


Senior Software Developer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top