473,395 Members | 1,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

accessdatasouce1.update using VB code in Asp.net

Dear Mr

I have problem , I add Button in Edit templete in form view1 and I put command accessdatasouce1.update . I find it is not working

I found No update happend and also No error I get it , I expect the command should be run from Accessdatasouce updatecommand specified in Aspx

please need your help , what is the missing ?

See the real code



ASPX code
Expand|Select|Wrap|Line Numbers
  1.  <asp:AccessDataSource ID="AccessDataSource1" runat="server" 
  2.             DataFile="~/App_Data/DB.accdb" 
  3.             DeleteCommand="DELETE FROM [cargo] WHERE [código] = ?" 
  4.             InsertCommand="INSERT INTO [cargo] ([código], [cargo]) VALUES (?, ?)" 
  5.             SelectCommand="SELECT * FROM [cargo]" 
  6.             UpdateCommand="UPDATE [cargo] SET [cargo] = ? WHERE [código] = ?">
  7.             <DeleteParameters>
  8.                 <asp:Parameter Name="código" Type="Int32" />
  9.             </DeleteParameters>
  10.             <InsertParameters>
  11.                 <asp:Parameter Name="código" Type="Int32" />
  12.                 <asp:Parameter Name="cargo" Type="String" />
  13.             </InsertParameters>
  14.             <UpdateParameters>
  15.                 <asp:Parameter Name="cargo" Type="String" />
  16.                 <asp:Parameter Name="código" Type="Int32" />
  17.             </UpdateParameters>
  18.         </asp:AccessDataSource>
  19.         <asp:FormView ID="FormView1" runat="server" DataKeyNames="código" 
  20.             DataSourceID="AccessDataSource1">
  21.             <EditItemTemplate>
  22.                 código:
  23.                 <asp:Label ID="códigoLabel1" runat="server" Text='<%# Eval("código") %>' />
  24.                 <br />
  25.                 cargo:
  26.                 <asp:TextBox ID="cargoTextBox" runat="server" Text='<%# Bind("cargo") %>' />
  27.                 <br />
  28.                 <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
  29.                     CommandName="Update" Text="Update" />
  30.                 &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
  31.                     CausesValidation="False" CommandName="Cancel" Text="Cancel" />
  32.                 &nbsp;<asp:Button ID="Button1" runat="server" onclick="Button1_Click" 
  33.                     Text="Button" />
  34.             </EditItemTemplate>
  35.             <InsertItemTemplate>
  36.                 cargo:
  37.                 <asp:TextBox ID="cargoTextBox" runat="server" Text='<%# Bind("cargo") %>' />
  38.                 <br />
  39.                 <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
  40.                     CommandName="Insert" Text="Insert" />
  41.                 &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
  42.                     CausesValidation="False" CommandName="Cancel" Text="Cancel" />
  43.             </InsertItemTemplate>
  44.             <ItemTemplate>
  45.                 código:
  46.                 <asp:Label ID="códigoLabel" runat="server" Text='<%# Eval("código") %>' />
  47.                 <br />
  48.                 cargo:
  49.                 <asp:Label ID="cargoLabel" runat="server" Text='<%# Bind("cargo") %>' />
  50.                 <br />
  51.                 <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" 
  52.                     CommandName="Edit" Text="Edit" />
  53.                 &nbsp;<asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" 
  54.                     CommandName="Delete" Text="Delete" />
  55.                 &nbsp;<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" 
  56.                     CommandName="New" Text="New" />
  57.             </ItemTemplate>
  58.         </asp:FormView>


VB :
Expand|Select|Wrap|Line Numbers
  1.     Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
  2.         AccessDataSource1.Update()
  3.         FormView1.ChangeMode(FormViewMode.ReadOnly)
  4.  
  5.     End Sub
Attached Files
File Type: zip WebSite1.zip (152.0 KB, 53 views)
Nov 4 '11 #1
0 1059

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Chinook | last post by:
Using code objects? =================== As an OO exercise I have a factory pattern that returns class objects that each have an "action" method. ClassObj.action() in turn returns a code object...
5
by: Andrei Pociu | last post by:
I have a major doubt about outputting text in ASP .NET when using code behind. I know most of the output you gain from a code behind file (.aspx.cs) is outputted to the Webform (.aspx) using...
4
by: Jim Hammond | last post by:
It would be udeful to be able to get the current on-screen values from a FormView that is databound to an ObjectDataSource by using a callback instead of a postback. For example: public void...
1
by: Karl | last post by:
Can you update the caption property for fields in a database using code?
5
by: Victor Reboucas | last post by:
Hi, I'm sure I'm missing something here, but.... I have a asp.net 2.0 web form and a calendar control. If I set the selectedDate clicking the control, no problem, but, if I set it using code I...
7
by: ApexData | last post by:
Hello I currently Link the FE/BE using the LinkTables Option and the Linked Table Manager. Any time I need to move the BE to another location, I have to go through this process over again. I...
1
by: Piotrekk | last post by:
Hi I have a strange problem. Here is some input data before I describe the problem. 1. RemoteClass (Mathematica) is compiled into dll and put to GAC 2. Server remoting configuration is done by...
8
by: Greg (codepug | last post by:
For lack of the proper expression, how do I excite a control to cause events to trigger. I have a date control and am using a calender form button to fill the text box with the date. The text box...
1
by: tekedge | last post by:
Hi, I have to do an update using a query which uses CTE . Could any body please tell me how I can do an update. I am unable to update if I replace the final select with an update one. Thanks...
0
by: AmitIper | last post by:
This Post is used to show how to bulk update records from grid view rather to updating one by one. The concept : create a xml string(string will contain all the records to be updated with some...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.