[CLOSED] Error in Store.Sync.

  1. #1

    [CLOSED] Error in Store.Sync.

    Now I create a gridPanel and update field. when you want to use store1.sync() which told me need to declare var. But I think I did it. so I want to find out which row I updated in the grid. in Internet I know the function "getModifiedRecords". but I can't use in gridpanel.getStore(), because it didn't show this function below gridpanel.getStore().

    any hints in my program? C#

    and My program is below second:
    the error is below first:

    Status Code: 200Status Text: BADRESPONSE: 語法錯誤
    
    {serviceResponse:{success:false,message:"System.Exception: Must declare the scalar variable \"@remark\". ---> System.Data.OleDb.OleDbException: Must declare the scalar variable \"@remark\".\r\n at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)\r\n at System.Data.OleDb.OleDbCommand.ExecuteNonQuery()\r\n at System.Web.UI.WebControls.SqlDataSourceView.ExecuteDbCommand(DbCommand command, DataSourceOperation operation)\r\n at System.Web.UI.WebControls.SqlDataSourceView.ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary oldValues)\r\n at System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback)\r\n at Ext.Net.Store.MakeUpdates(IDataSource ds, JArray data) in D:\\component_download\\extnet-Ext.NET.Pro-4a10352\\Ext.Net\\Ext\\Data\\Store.cs:line 890\r\n at Ext.Net.Store.MakeChanges() in D:\\component_download\\extnet-Ext.NET.Pro-4a10352\\Ext.Net\\Ext\\Data\\Store.cs:line 829\r\n at Ext.Net.Store.DoSaving(String action, String jsonData, JToken parameters) in D:\\component_download\\extnet-Ext.NET.Pro-4a10352\\Ext.Net\\Ext\\Data\\Store.cs:line 793\r\n --- End of inner exception stack trace ---\r\n at Ext.Net.Store.DoSaving(String action, String jsonData, JToken parameters) in D:\\component_download\\extnet-Ext.NET.Pro-4a10352\\Ext.Net\\Ext\\Data\\Store.cs:line 806\r\n at Ext.Net.Store.RaiseAjaxPostBackEvent(String eventArgument) in D:\\component_download\\extnet-Ext.NET.Pro-4a10352\\Ext.Net\\Ext\\Data\\Store.cs:line 1131",data:}}
    <!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 id="Head1" runat="server">
        <title>己辭職員工例外處理</title>
        <style type="text/css">
           .x-grid-cell-fullName .x-grid-cell-inner {
                font-family : tahoma, verdana;
                display     : block;
                font-weight : normal;
                font-style  : normal;
                color       : #385F95;
                white-space : normal;
            }
            
            .x-grid-rowbody div {
                margin : 2px 5px 20px 5px !important;
                width  : 99%;
                color  : Gray;
            }
            
            .x-grid-row-expanded td.x-grid-cell{
                border-bottom-width:0px;
            }
            .icon-exclamation {
                padding-left: 25px !important;
                background: url(/icons/exclamation-png/ext.axd) no-repeat 3px 0px !important;
            }
            
            .icon-accept {
                padding-left: 25px !important;
                background: url(/icons/accept-png/ext.axd) no-repeat 3px 0px !important;
            }
            .my-panel
            {
                padding-left: 50px;
                padding-top: 50px;
                padding-bottom: 50px;
             }
        </style>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <ext:resourcemanager ID="ResourceManager1" runat="server" 
                DirectMethodNamespace="temp" />
        
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="<%$ ConnectionStrings:CrystralConnString %>" 
                SelectCommand="SELECT excludeID, staffID, remark, insertUser, insertDate, updateUser, updateDate FROM tblExcludeStaff  where isDel=0"
                UpdateCommand = "update tblExcludeStaff set remark = @remark, staffID = @staffID where excludeID = @excludeID"
                ProviderName="<%$ ConnectionStrings:CrystralConnString.ProviderName %>" >
                <UpdateParameters>
                    <asp:Parameter Name="remark" Type="String" />
                    <asp:Parameter Name="staffID" Type="String" />
                    <asp:Parameter Name="excludeID" Type="Int32" />
                </UpdateParameters>
            </asp:SqlDataSource>
    
        </div>
                        <ext:GridPanel ID="GridPanel1" runat="server" Title="Data detail" Height="500px">
                            <Store>
                                <ext:Store ID="Store1" runat="server" DataSourceID="SqlDataSource1" OnReadData="Store1_RefershData">
                                    <Model>
                                        <ext:Model runat="server" IDProperty="excludeID">
                                            <Fields>
                                                <ext:ModelField name="excludeID" />
                                                <ext:ModelField name="staffID" Type="String" />
                                                <ext:ModelField name="remark" Type="String" />
                                                <ext:ModelField name="insertUser" />
                                                <ext:ModelField name="insertDate" />
                                                <ext:ModelField name="updateUser" />
                                                <ext:ModelField name="updateDate" />
                                            </Fields>
                                        </ext:Model>
                                    </Model>
                                    <Listeners>
                                        <Exception Handler="Ext.Msg.alert('Operation failed', operation.getError());" />                
                                        <Write Handler="Ext.Msg.alert('Write', 'The data successfully saved');" />
                                    </Listeners>
                                </ext:Store>
                            </Store>
    
                            <ColumnModel ID="ColumnModel1" runat="server">
                                <Columns>
                                    <ext:Column ID="excludeID" runat="server" Text="System ID" width="100" DataIndex="excludeID" Hidden="true" />
                                    <ext:Column ID="staffID" runat="server" Text="Staff ID" width="100" DataIndex="staffID">
                                        <Editor>
                                            <ext:TextField runat="server" />
                                        </Editor>
                                    </ext:Column> 
                                    <ext:Column ID="remark" runat="server" Text="remark" width="200" DataIndex="remark">
                                        <Editor>
                                            <ext:TextField runat="server" />
                                        </Editor>
                                    </ext:Column> 
                                    <ext:Column ID="insertUser" runat="server" Text="Inupt_staff" width="200" DataIndex="insertUser" Hidden="true" />
                                    <ext:Column ID="insertDate" runat="server" Text="input date" width="200" DataIndex="insertDate" Hidden="true" />
                                    <ext:Column ID="updateUser" runat="server" Text="last update user" width="200" DataIndex="updateUser" Hidden="true" />
                                    <ext:Column ID="updateDate" runat="server" Text="last update date" width="200" DataIndex="updateDate" Hidden="true" />
                                </Columns>
                            </ColumnModel>
                            <SelectionModel>
                                <ext:RowSelectionModel runat="server" Mode="Multi" />
                            </SelectionModel>
                            <View>
                                <ext:GridView ID="GridView1" runat="server">
                                    <GetRowClass Handler="return 'x-grid-row-expanded';" />
                                </ext:GridView>
                            </View>
                            <Plugins>
                                <ext:CellEditing runat="server" />
                            </Plugins>
                        </ext:GridPanel>
                    </Items>
    
                    <Buttons>
                        <ext:Button ID="btnSave" runat="server"  Text="Sync" Icon="Disk">
                            <Listeners>
                                <Click Handler="#{Store1}.sync();" />
                            </Listeners>
                        </ext:Button>
                    </Buttons>
                </ext:Panel>
            </Items>
        </ext:tabpanel>
    
        </form>
    </body>
    </html>
    Last edited by Daniil; Dec 04, 2012 at 8:52 AM. Reason: Please use [CODE] tags, [CLOSED]
  2. #2
    'getModifiedRecords' still exists
    I don't see in your sample where do you try to use it

    Does remark record field have a value in updated record?
  3. #3
    Can I ask about how can I get which row I updated in the gridpanel?

    I think it is easy to answer. before question I think it is easy to confuse. Sorry.

    I am using extnet, version 2.
    Last edited by mis@adphk.com; Dec 02, 2012 at 12:38 PM.
  4. #4
    To retrieve update records you can use the following javascript code
    var updatedRecords = App.GridPanel1.store.getUpdatedRecords();
  5. #5
    I am still can't find this method.
    I am try to call this method in front-end program.


    Quote Originally Posted by Vladimir View Post
    To retrieve update records you can use the following javascript code
    var updatedRecords = App.GridPanel1.store.getUpdatedRecords();
  6. #6
    Please provide test sample where you try to get updated records
  7. #7
    in my question, i find out is updateCommand problem.

    "UpdateCommand = "update tblExcludeStaff set remark = @remark, staffID = @staffID where excludeID = @excludeID"
    Error message said I need to declare "declare the scalar variable \"@remark\". ---> ", and I try to delete this command line and use auto-sync. the program can save data to db.

    so I wanna ask where declare var in this case?
    Last edited by Daniil; Dec 03, 2012 at 6:37 AM. Reason: Please use [CODE] tags
  8. #8
    Sorry, I don't understand your requirement clearly, define that var where you need
  9. #9
    Quote Originally Posted by Vladimir View Post
    Sorry, I don't understand your requirement clearly, define that var where you need
    Thanks for your reply. I think it isn't code problem. Now I change to a new connection string. The program is working.
    UpdateCommand="Update tblExcludeStaff set remark=@remark where excludeID=@excludeID"
    so is it any different with my below two connection string?

    1. it is work.
    <add name="CrystalConnectionStringtest" connectionString="Data Source=192.168.0.5;Initial Catalog=Crystal;User ID=sa;Password=sasa"
          providerName="System.Data.SqlClient" />
    2. it didn't work. ask me to declare var.
    <add name="CrystralConnString" connectionString="Provider=SQLOLEDB;Data Source=192.168.0.5;Persist Security Info=True;Password=sa;User ID=Crystal;Initial Catalog=Crystal"
          providerName="System.Data.OleDb" />
    Last edited by Daniil; Dec 03, 2012 at 6:39 AM. Reason: Please use [CODE] tags
  10. #10
    I see the second connection string is without a password. Maybe this causes the problem.

Similar Threads

  1. [CLOSED] bug in combobox valuefield ExtNet 2.1
    By mirwais in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Nov 16, 2012, 4:23 PM
  2. [CLOSED] Runtime client error in /extnet/extnet-core-js/ext.axd?v=0
    By vadym.f in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Aug 26, 2012, 7:13 AM
  3. [CLOSED] Coolite 0.8.2 and ExtNet 2.0 in the same project?
    By Pablo in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 13, 2012, 6:54 PM
  4. updating to ExtNet 1.0 from 0.8.2
    By unaltro2 in forum 1.x Help
    Replies: 6
    Last Post: Jun 03, 2011, 5:14 PM
  5. [CLOSED] Errors in extnet css
    By acrossdev in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Oct 07, 2010, 9:00 AM

Posting Permissions