Click here to Skip to main content
15,885,757 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionThe future of entity framework and LINQ? Pin
Brendan Vogt31-May-09 5:17
Brendan Vogt31-May-09 5:17 
AnswerRe: The future of entity framework and LINQ? Pin
Ramesh Swaminathan31-May-09 5:44
Ramesh Swaminathan31-May-09 5:44 
QuestionDeployment error Pin
Clement Siby31-May-09 3:29
Clement Siby31-May-09 3:29 
AnswerRe: Deployment error Pin
Ramesh Swaminathan31-May-09 4:51
Ramesh Swaminathan31-May-09 4:51 
GeneralRe: Deployment error Pin
Clement Siby31-May-09 4:55
Clement Siby31-May-09 4:55 
GeneralRe: Deployment error Pin
Ramesh Swaminathan31-May-09 5:01
Ramesh Swaminathan31-May-09 5:01 
GeneralRe: Deployment error Pin
Clement Siby31-May-09 6:12
Clement Siby31-May-09 6:12 
QuestionConnecting To A Database ASP .NET [All Code Included = Long Topic] Pin
eginteractive31-May-09 3:13
eginteractive31-May-09 3:13 
I'm on my last nerve with this. I have been working for over 6 hours trying to figure out how to get this to work. Here is what went down:

I created my site, which is esentially just a database of people who work for me, their positions, ect. I created it offline, using Visual Studio 2008 Professional, and created the database under SQL Server 2005. I went to upload all my files, and my databases were stored in my app_data folder which was also uploaded. I have an app_code folder with my datasets in them.

Here is what my code looks like for...

web.config:

<?xml version="1.0"?>
<!-- 
    Note: As an alternative to hand editing this file you can use the 
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in 
    machine.config.comments usually located in 
    \Windows\Microsoft.Net\Framework\v2.x\Config 
-->
<configuration>
	<appSettings/>
	<connectionStrings>
    <add name="ConnectionString" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|database.mdf;User Instance=true"/>
  </connectionStrings>
	<system.web>
    <compilation debug="true" strict="false" explicit="true">
		</compilation>
		<pages>
			<namespaces>
				<clear/>
				<add namespace="System"/>
				<add namespace="System.Collections"/>
				<add namespace="System.Collections.Generic"/>
				<add namespace="System.Collections.Specialized"/>
				<add namespace="System.Configuration"/>
				<add namespace="System.Text"/>
				<add namespace="System.Text.RegularExpressions"/>
				<add namespace="System.Web"/>
				<add namespace="System.Web.Caching"/>
				<add namespace="System.Web.SessionState"/>
				<add namespace="System.Web.Security"/>
				<add namespace="System.Web.Profile"/>
				<add namespace="System.Web.UI"/>
				<add namespace="System.Web.UI.WebControls"/>
				<add namespace="System.Web.UI.WebControls.WebParts"/>
				<add namespace="System.Web.UI.HtmlControls"/>
			</namespaces>
		</pages>
		<!--
            The <authentication> section enables configuration 
            of the security authentication mode used by 
            ASP.NET to identify an incoming user. 
        -->
		<authentication mode="Windows"/>
		<!--
            The <customErrors> section enables configuration 
            of what to do if/when an unhandled error occurs 
            during the execution of a request. Specifically, 
            it enables developers to configure html error pages 
            to be displayed in place of a error stack trace.

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
        -->
	</system.web>
</configuration>



Default.aspx.vb:
<pre>Partial Class _Default
    Inherits System.Web.UI.Page
    Dim DbConnect As String = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString
End Class


Default.aspx:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body style="font-family: Arial, Helvetica, sans-serif">
    <form id="form1" runat="server">
    <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" 
        DataSourceID="ObjectDataSource1" DataTextField="Position" 
        DataValueField="Position">
    </asp:DropDownList>
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
        OldValuesParameterFormatString="original_{0}" SelectMethod="Getposition" 
        TypeName="DataSet1TableAdapters.PositionlistTableAdapter">
    </asp:ObjectDataSource>
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
        AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="ID" 
        DataSourceID="ObjectDataSource2">
        <Columns>
            <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" 
                ReadOnly="True" SortExpression="ID" />
            <asp:BoundField DataField="Position" HeaderText="Position" 
                SortExpression="Position" />
            <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
            <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
            <asp:HyperLinkField DataNavigateUrlFields="ID" 
                DataNavigateUrlFormatString="Details.aspx?field={0}" HeaderText="Details" 
                Text="detail" />
        </Columns>
    </asp:GridView>
    <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" 
        DeleteMethod="Delete" InsertMethod="Insert" 
        OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" 
        TypeName="DataSet1TableAdapters.teamTableAdapter" UpdateMethod="Update">
        <DeleteParameters>
            <asp:Parameter Name="Original_ID" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="Position" Type="String" />
            <asp:Parameter Name="Name" Type="String" />
            <asp:Parameter Name="Email" Type="String" />
            <asp:Parameter Name="Original_ID" Type="Int32" />
        </UpdateParameters>
        <SelectParameters>
            <asp:ControlParameter ControlID="DropDownList1" Name="position" 
                PropertyName="SelectedValue" Type="String" />
        </SelectParameters>
        <InsertParameters>
            <asp:Parameter Name="Position" Type="String" />
            <asp:Parameter Name="Name" Type="String" />
            <asp:Parameter Name="Email" Type="String" />
        </InsertParameters>
    </asp:ObjectDataSource>
    </form>
</body>
</html>


Details.aspx:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Details.aspx.vb" Inherits="Details" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div style="font-family: Arial, Helvetica, sans-serif">
    
        <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
            DataKeyNames="ID" DataSourceID="ObjectDataSource1" Height="50px" Width="125px">
            <Fields>
                <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" 
                    ReadOnly="True" SortExpression="ID" />
                <asp:BoundField DataField="Position" HeaderText="Position" 
                    SortExpression="Position" />
                <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
                <asp:CommandField ShowEditButton="True" />
            </Fields>
        </asp:DetailsView>
        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
            DeleteMethod="Delete" InsertMethod="Insert" 
            OldValuesParameterFormatString="original_{0}" SelectMethod="GetDataByID" 
            TypeName="DataSet1TableAdapters.teamTableAdapter" UpdateMethod="Update">
            <DeleteParameters>
                <asp:Parameter Name="Original_ID" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="Position" Type="String" />
                <asp:Parameter Name="Name" Type="String" />
                <asp:Parameter Name="Email" Type="String" />
                <asp:Parameter Name="Original_ID" Type="Int32" />
            </UpdateParameters>
            <SelectParameters>
                <asp:QueryStringParameter Name="ID" QueryStringField="ID" Type="Int32" />
            </SelectParameters>
            <InsertParameters>
                <asp:Parameter Name="Position" Type="String" />
                <asp:Parameter Name="Name" Type="String" />
                <asp:Parameter Name="Email" Type="String" />
            </InsertParameters>
        </asp:ObjectDataSource>
    
    </div>
    </form>
    <p>
        <a href="Default.aspx">Default.aspx</a></p>
</body>
</html>


Details.aspx.vb:

Partial Class Details
    Inherits System.Web.UI.Page
    Dim DbConnect As String = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString
End Class


I gave all the code I have, and am seriously considering giving up on this whole project. The thing is, the code works fine when I test it on my PC, but the minute I upload it online and go to my website I get this error:

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>


Please help me, I'm going literally insane by not getting this to work. Any help is greatly appreciated. I've done a great deal of searching and nothing has helped me.
AnswerRe: Connecting To A Database ASP .NET [All Code Included = Long Topic] Pin
mrcooll31-May-09 3:25
mrcooll31-May-09 3:25 
GeneralRe: Connecting To A Database ASP .NET [All Code Included = Long Topic] Pin
eginteractive31-May-09 3:27
eginteractive31-May-09 3:27 
GeneralRe: Connecting To A Database ASP .NET [All Code Included = Long Topic] Pin
mrcooll31-May-09 3:31
mrcooll31-May-09 3:31 
AnswerRe: Connecting To A Database ASP .NET [All Code Included = Long Topic] Pin
Ramesh Swaminathan31-May-09 3:28
Ramesh Swaminathan31-May-09 3:28 
GeneralRe: Connecting To A Database ASP .NET [All Code Included = Long Topic] Pin
eginteractive31-May-09 3:32
eginteractive31-May-09 3:32 
GeneralRe: Connecting To A Database ASP .NET [All Code Included = Long Topic] Pin
Ramesh Swaminathan31-May-09 3:36
Ramesh Swaminathan31-May-09 3:36 
GeneralRe: Connecting To A Database ASP .NET [All Code Included = Long Topic] Pin
eginteractive31-May-09 3:38
eginteractive31-May-09 3:38 
GeneralRe: Connecting To A Database ASP .NET [All Code Included = Long Topic] Pin
Ramesh Swaminathan31-May-09 3:44
Ramesh Swaminathan31-May-09 3:44 
GeneralRe: Connecting To A Database ASP .NET [All Code Included = Long Topic] Pin
eginteractive31-May-09 3:46
eginteractive31-May-09 3:46 
GeneralRe: Connecting To A Database ASP .NET [All Code Included = Long Topic] Pin
Ramesh Swaminathan31-May-09 3:52
Ramesh Swaminathan31-May-09 3:52 
GeneralRe: Connecting To A Database ASP .NET [All Code Included = Long Topic] Pin
eginteractive31-May-09 3:55
eginteractive31-May-09 3:55 
GeneralRe: Connecting To A Database ASP .NET [All Code Included = Long Topic] [modified] Pin
Ramesh Swaminathan31-May-09 4:08
Ramesh Swaminathan31-May-09 4:08 
GeneralRe: Connecting To A Database ASP .NET [All Code Included = Long Topic] Pin
eginteractive31-May-09 4:11
eginteractive31-May-09 4:11 
GeneralRe: Connecting To A Database ASP .NET [All Code Included = Long Topic] Pin
Ramesh Swaminathan31-May-09 4:22
Ramesh Swaminathan31-May-09 4:22 
GeneralRe: Connecting To A Database ASP .NET [All Code Included = Long Topic] Pin
eginteractive31-May-09 8:45
eginteractive31-May-09 8:45 
Questionc# retrieve total non-paged memory usage remotely Pin
jw0rd31-May-09 3:03
jw0rd31-May-09 3:03 
Generalwhen to use state server out procees session and sql server out process session Pin
sunkrajesh31-May-09 2:26
sunkrajesh31-May-09 2:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.