Quantcast
Channel: Visual Studio and Visual Web Developer Express
Viewing all articles
Browse latest Browse all 3509

Data Details View- SQL Server Connection String

$
0
0

 I would appreciate if  anybody help on this.   I have created a details view and connected to SQL server Table views.  When I enter data and click on "New", I get error message following error:

_________________________________________

Server Error in '/Sec8QC' Application.


Inserting is not supported by data source 'SqlDataSource1' unless InsertCommand is specified.

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.NotSupportedException: Inserting is not supported by data source 'SqlDataSource1' unless InsertCommand is specified.

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: 

[NotSupportedException: Inserting is not supported by data source 'SqlDataSource1' unless InsertCommand is specified.]
   System.Web.UI.WebControls.SqlDataSourceView.ExecuteInsert(IDictionary values) +3325679
   System.Web.UI.DataSourceView.Insert(IDictionary values, DataSourceViewOperationCallback callback) +3434125
   System.Web.UI.WebControls.DetailsView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +678
   System.Web.UI.WebControls.DetailsViewRow.OnBubbleEvent(Object source, EventArgs e) +148
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +84
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3804

 


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34

___________________________________________

MY Codes are below.......................................

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="QC.aspx.cs" Inherits="QC" %>

 

<!DOCTYPE html>

 

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title></title>

    <style type="text/css">

        #form1 {

            height: 78px;

            width: 218px;

            margin-left: 0px;

            margin-bottom: 0px;

        }

    </style>

</head>

<body>

    <form id="form1" runat="server">

        <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" BackColor="White" BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" CellPadding="4" DataKeyNames="TenantID" DataSourceID="SqlDataSource1" Height="87px" Width="145px" style="margin-top: 2px">

            <EditRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />

            <Fields>

                <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />

                <asp:BoundField DataField="DistircManager" HeaderText="DistircManager" SortExpression="DistircManager" />

                <asp:BoundField DataField="AuditorName" HeaderText="AuditorName" SortExpression="AuditorName" />

                <asp:BoundField DataField="AssistantDirector" HeaderText="AssistantDirector" SortExpression="AssistantDirector" />

                <asp:BoundField DataField="MoveInDate" HeaderText="MoveInDate" SortExpression="MoveInDate" />

                <asp:BoundField DataField="TransferDate" HeaderText="TransferDate" SortExpression="TransferDate" />

                <asp:CheckBoxField DataField="DOB/SSN" HeaderText="DOB/SSN" SortExpression="DOB/SSN" />

                <asp:CheckBoxField DataField="FamilyMembersListed" HeaderText="FamilyMembersListed" SortExpression="FamilyMembersListed" />

                <asp:CommandField ButtonType="Button" ShowInsertButton="True" />

            </Fields>

            <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />

            <HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />

            <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />

            <RowStyle BackColor="White" ForeColor="#003399" />

        </asp:DetailsView>

        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:PtsConnectionString %>"

            SelectCommand="SELECT * FROM [VLQC]"></asp:SqlDataSource>

    </form>

</body>

</html>


Viewing all articles
Browse latest Browse all 3509

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>