473,396 Members | 1,992 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,396 software developers and data experts.

updating a oldb datasource

I have a grideiw that feeds a detailView via 2 AccessDateSources the
detail view has and update command that
UpdateCommand="UPDATE [account] SET [acctnum] = ? WHERE [acctCode] =
[acctCode_ID_FK]"
does'nt update since it doesn't recognize the info from the DetailView
that it needs to do the update

any ideas?
<asp:AccessDataSource ID="AccessDataSource1" Runat="server"
DataFile="e:\db\travel\mile.mdb"
SelectCommand="SELECT employee.lastName,
employee.firstName, account_supervisor_int.acctCode_ID_FK,
account_supervisor_int.employee_ID_FK, employee.employeeID,
account.acctCode, account.acctnum FROM employee, account,
account_supervisor_int WHERE
(((account_supervisor_int.acctCode_ID_FK)=[acctCode]) AND
((account_supervisor_int.employee_ID_FK)=[employeeid]))" >
</asp:AccessDataSource>
<asp:GridView ID="GridView1" Runat="server" AllowPaging="True"
AllowSorting="True" DataSourceID="AccessDataSource1"
DataKeyNames="employeeid" AutoGenerateSelectButton="True">
</asp:GridView>
<asp:AccessDataSource ID="AccessDataSource2" Runat="server"
DataFile="e:\db\travel\mile.mdb"
SelectCommand="SELECT employee.lastName,
employee.firstName, account_supervisor_int.acctCode_ID_FK,
account_supervisor_int.employee_ID_FK, employee.employeeID,
account.acctCode, account.acctnum FROM employee, account,
account_supervisor_int WHERE
(((account_supervisor_int.acctCode_ID_FK)=[acctCode]) AND
((account_supervisor_int.employee_ID_FK)=[employeeid]))"
UpdateCommand="UPDATE [account] SET [acctnum] = ? WHERE
[acctCode] = [acctCode_ID_FK]"
InsertCommand="INSERT INTO [employee] ([employeeid])
VALUES (employeeid)" FilterExpression="employeeid='@employeeid'">
<FilterParameters>
<asp:ControlParameter Name="employeeid"
ControlID="GridView1"
PropertyName="SelectedValue"></asp:ControlParameter>
</FilterParameters>
</asp:AccessDataSource>
<asp:DetailsView ID="DetailsView1" Runat="server"
AutoGenerateDeleteButton="False"
AutoGenerateEditButton="True"
DataSourceID="AccessDataSource2" DataKeyNames="acctCode"
AutoGenerateInsertButton="False"
onitemupdated="DetailsView1_ItemUpdated" >
</asp:DetailsView>
Nov 19 '05 #1
1 1928
turns out that
when you use a update command like:
updatecommand="UPDATE account SET acctnum = ? WHERE acctCode = ?"
then fields that are getting updated need to match up in your select
command
so by making acctnum and acctcode the same "ordinal" as in the update
Asp.Net matched em up.

selectcommand="SELECT account.acctnum, account.acctCode,
employee.lastName, employee.firstName,
account_supervisor_int.acctCode_ID_FK,
account_supervisor_int.employee_ID_FK, employee.employeeID FROM
employee, account, account_supervisor_int WHERE
(((account_supervisor_int.acctCode_ID_FK)=[acctCode]) AND
((account_supervisor_int.employee_ID_FK)=[employeeid]))"

<%@Page Language="C#" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>

</head>
<body onload="init()" background="./images/indtextb.jpg"
bgcolor="#FFFFFF" text="#000000" link="navy" vlink="navy"
alink="navy">
<form runat="server">

<asp:accessdatasource
id="AccessDataSource1"
runat="server"
datasourcemode="DataSet"
datafile="f:\db\travel\mile.mdb"
selectcommand="SELECT account.acctnum, account.acctCode,
employee.lastName, employee.firstName,
account_supervisor_int.acctCode_ID_FK,
account_supervisor_int.employee_ID_FK, employee.employeeID FROM
employee, account, account_supervisor_int WHERE
(((account_supervisor_int.acctCode_ID_FK)=[acctCode]) AND
((account_supervisor_int.employee_ID_FK)=[employeeid]))"
updatecommand="UPDATE account SET acctnum = ? WHERE acctCode =
?" >
</asp:accessdatasource>
<br />
<br />
<asp:gridview
id="GridView1"
runat="server"
autogeneratecolumns="False"
datakeynames="acctCode"
autogenerateeditbutton="True"
datasourceid="AccessDataSource1">
<HeaderStyle BorderColor="White" BackColor="SILVER"
ForeColor="navy" Font-Bold="True" Font-Names="Arial" Font-Size="9"
HorizontalAlign="Center" />
<RowStyle BorderColor="" BackColor="lightsteelblue"
ForeColor="navy" Font-Names="Arial" Font-Size="12" Font-Bold="True"
HorizontalAlign="Center" />
<columns>
<asp:boundfield headertext="acctnum" datafield="acctnum"
/>
<asp:boundfield headertext="firstName"
datafield="FirstName" ReadOnly />
<asp:boundfield headertext="lastName" datafield="LastName"
ReadOnly/>
</columns>
</asp:gridview>

</form>
</BODY>
</HTML>

me******@gmail.com (rob merritt) wrote in message news:<36**************************@posting.google. com>...
I have a grideiw that feeds a detailView via 2 AccessDateSources the
detail view has and update command that
UpdateCommand="UPDATE [account] SET [acctnum] = ? WHERE [acctCode] =
[acctCode_ID_FK]"
does'nt update since it doesn't recognize the info from the DetailView
that it needs to do the update

any ideas?
<asp:AccessDataSource ID="AccessDataSource1" Runat="server"
DataFile="e:\db\travel\mile.mdb"
SelectCommand="SELECT employee.lastName,
employee.firstName, account_supervisor_int.acctCode_ID_FK,
account_supervisor_int.employee_ID_FK, employee.employeeID,
account.acctCode, account.acctnum FROM employee, account,
account_supervisor_int WHERE
(((account_supervisor_int.acctCode_ID_FK)=[acctCode]) AND
((account_supervisor_int.employee_ID_FK)=[employeeid]))" >
</asp:AccessDataSource>
<asp:GridView ID="GridView1" Runat="server" AllowPaging="True"
AllowSorting="True" DataSourceID="AccessDataSource1"
DataKeyNames="employeeid" AutoGenerateSelectButton="True">
</asp:GridView>
<asp:AccessDataSource ID="AccessDataSource2" Runat="server"
DataFile="e:\db\travel\mile.mdb"
SelectCommand="SELECT employee.lastName,
employee.firstName, account_supervisor_int.acctCode_ID_FK,
account_supervisor_int.employee_ID_FK, employee.employeeID,
account.acctCode, account.acctnum FROM employee, account,
account_supervisor_int WHERE
(((account_supervisor_int.acctCode_ID_FK)=[acctCode]) AND
((account_supervisor_int.employee_ID_FK)=[employeeid]))"
UpdateCommand="UPDATE [account] SET [acctnum] = ? WHERE
[acctCode] = [acctCode_ID_FK]"
InsertCommand="INSERT INTO [employee] ([employeeid])
VALUES (employeeid)" FilterExpression="employeeid='@employeeid'">
<FilterParameters>
<asp:ControlParameter Name="employeeid"
ControlID="GridView1"
PropertyName="SelectedValue"></asp:ControlParameter>
</FilterParameters>
</asp:AccessDataSource>
<asp:DetailsView ID="DetailsView1" Runat="server"
AutoGenerateDeleteButton="False"
AutoGenerateEditButton="True"
DataSourceID="AccessDataSource2" DataKeyNames="acctCode"
AutoGenerateInsertButton="False"
onitemupdated="DetailsView1_ItemUpdated" >
</asp:DetailsView>

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Bernard André | last post by:
Hi All, context: I am using Access 97 tablkes with VB. I can see records in the MDB, using Adodc and datagrid. No problem. But when doing: rsprivate.AddNew rsprivate!For =...
1
by: Patrick Delifer | last post by:
HI, I am trying to update a DataGrid where I want to rebind just the row that was updated. Here's the situation: 1) Updating is not a problem, it works fine. 2) I am not using ItemCommand (edit,...
1
by: Gert Albertse | last post by:
When I try to update my access database, nothing get updated. Here is my code: <%@ Page Language="VB" Debug="true" %> <script runat="server"> ' Insert page code here ' Function...
3
by: | last post by:
Hello, I have created an ASP.NET 2.0 application that utilized a Gridview Control to display and update/delete data. The problem I am having is that the gridview control is displaying the data...
2
by: Bob | last post by:
I have an ArryList that I'm using as a datasource for a combobox. As an item is selected in the combobox and processed I'd like to remove it from the combobox. When I try I get an error stating...
1
by: zoneal | last post by:
I retrieved the following function from VB.NET help and added a few statements for updating the datasource. But, it does not actually commence the InsertCommand property of the DataAdapter in order...
1
by: MethMath | last post by:
I have problems with a webservice receiving data in turn updating an Odbc-linked Access database on the same computer. The Odbc engine gives me an OdbcExceptionError: Message: Operation must...
5
by: Mark R. Dawson | last post by:
Hi all, I may be missing something with how databinding works but I have bound a datasource to a control and everything is great, the control updates to reflect the state of my datasource when I...
5
by: Michael | last post by:
Hi Everyone, I've been having a problem with the Gridview control. I have posted a few messages relating to the issues, but I have a general question. Does the Dataview control have to be bound to...
1
by: Johnny E. Jensen | last post by:
Hello To update a dataset i created a method (see below) My question is, how to return the created Primary ID that is created on the server auto incremential. Is there anyway to place that value...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.