Ask a Question related to Dreamweaver AppDev, Design and Development.
-
Ad_dee #1
cannot update datagrid
Hi All,
I am new user of DW MX in developing asp.net application
After I create a datagrid which is binded by the dataset, then I add the
delete and edit button on it. The delete one is fine, however, when I use the
Update button, the following error message appear. I have already googled
through this problem, however, no answer can be found by me.
Do any one have any idea or solution?
Remark: My config
OS: Win XP pro
DB: MS Sql 2000
Tool: Dreamweaver MX 2004(have updated to 7.0.1)
VS.Net 2003
Thank you
Ad_dee
**********************Error Message ***************************
System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'WHERE'.
at System.Data.SqlClient.SqlCommand.ExecuteReader(Com mandBehavior cmdBehavior,
RunBehavior runBehavior, Boolean returnStream)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at DreamweaverCtrls.DataSet.OnDataGridUpdate(Object Src,
DataGridCommandEventArgs E)
*******************End of Error Message ************************
************************Source Code **************************
<%@ Register TagPrefix="MM" Namespace="DreamweaverCtrls"
Assembly="DreamweaverCtrls,version=1.0.0.0,publicK eyToken=836f606ede05d46a,cultu
re=neutral" %>
<%@ Page language="c#" Codebehind="WebForm2.aspx.cs" AutoEventWireup="false"
Inherits="WebApplication1.WebForm2" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm2</title>
<MM:DataSet
id="DataSet1"
runat="Server"
IsStoredProcedure="false"
ConnectionString='<%#
System.Configuration.ConfigurationSettings.AppSett ings["MM_CONNECTION_STRING_con
ntest"] %>'
DatabaseType='<%#
System.Configuration.ConfigurationSettings.AppSett ings["MM_CONNECTION_DATABASETY
PE_conntest"] %>'
CommandText='<%# "SELECT * FROM dbo.Table1" %>'
Debug="true"<EditOps>>
<EditOpsTable Name="dbo.Table1" />
<Parameter Name="test1" Type="Int" IsPrimary="true" />
</EditOps>
</MM:DataSet>
<MM:PageBind runat="server" PostBackBind="true" />
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form runat="server">
<asp:DataGrid AllowPaging="false"
AllowSorting="False"
AutoGenerateColumns="false"
CellPadding="3"
CellSpacing="0" DataKeyField="test1"
DataSource="<%# DataSet1.DefaultView %>" id="DataGrid1"
runat="server"
ShowFooter="false"
ShowHeader="true" OnUpdateCommand="DataSet1.OnDataGridUpdate"
OnEditCommand="DataSet1.OnDataGridEdit"
OnCancelCommand="DataSet1.OnDataGridCancel"
OnDeleteCommand="DataSet1.OnDataGridDelete"
OnItemDataBound="DataSet1.OnDataGridItemDataBound"<HeaderStyle HorizontalAlign="center" BackColor="#E8EBFD">
ForeColor="#3D3DB6" Font-Name="Verdana, Arial, Helvetica, sans-serif"
Font-Bold="true" Font-Size="smaller" />
<ItemStyle BackColor="#F2F2F2" Font-Name="Verdana, Arial, Helvetica,
sans-serif" Font-Size="smaller" />
<AlternatingItemStyle BackColor="#E5E5E5" Font-Name="Verdana, Arial,
Helvetica, sans-serif" Font-Size="smaller" />
<FooterStyle HorizontalAlign="center" BackColor="#E8EBFD"
ForeColor="#3D3DB6" Font-Name="Verdana, Arial, Helvetica, sans-serif"
Font-Bold="true" Font-Size="smaller" />
<PagerStyle BackColor="white" Font-Name="Verdana, Arial, Helvetica,
sans-serif" Font-Size="smaller" />
<Columns>
<asp:BoundColumn DataField="test1" HeaderText="test1"
ReadOnly="true" Visible="True" />
<asp:BoundColumn DataField="ch1" HeaderText="ch1"
ReadOnly="true" Visible="True" />
<asp:BoundColumn DataField="ch2" HeaderText="ch2"
ReadOnly="true" Visible="True" />
<asp:ButtonColumn
ButtonType="LinkButton"
CommandName="Delete"
HeaderText="de"
Text="Delete"
Visible="True"/>
<asp:EditCommandColumn
ButtonType="LinkButton"
CancelText="Cancel"
EditText="Edit"
HeaderText="ed"
UpdateText="Update"
Visible="True"/>
</Columns>
</asp:DataGrid>
</form>
</body>
</HTML>
********************End of Source Code *************************
Ad_dee Guest
-
How to add a Dropdown list to a datagrid at runtime (dynamic) without using template columns in ASP.NET and still have the ability to us the datagrid Update event.
How to add a Dropdown list to a datagrid at runtime (dynamic) without using template columns in ASP.NET and still have the ability to us the... -
DataGrid ItemStyle is a textbox and doesn't update the datagrid datasource
I have a datagrid with two columns, the first a normal bound column, the second is a template column created from a bound column. For the... -
DataGrid easy Edit-Update using ADO.NET/DataGrid functionality C#?
Hi, so I am using built in Edit, Delete, Update i.e. OnEditCommand="DataGrid1_Edit" OnUpdateCommand="DataGrid1_Update" with handler question below... -
Can't update in DataGrid
I have looked at all the examples and written a datagrid page with update features, but the update doesn't work. Basically, it never executes the... -
To all Gurus: How can I edit/update a DataGrid in a DataGrid (nested DataGrid)? Possible?
Hello, I am searching the whole Internet for a good example how to edit/update a DataGrid in a DataGrid (nested DataGrid). I know how to...



Reply With Quote

