PC Review


Reply
Thread Tools Rate Thread

updating a oldb datasource

 
 
rob merritt
Guest
Posts: n/a
 
      27th Mar 2005
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>
<aspetailsView ID="DetailsView1" Runat="server"
AutoGenerateDeleteButton="False"
AutoGenerateEditButton="True"
DataSourceID="AccessDataSource2" DataKeyNames="acctCode"
AutoGenerateInsertButton="False"
onitemupdated="DetailsView1_ItemUpdated" >
</aspetailsView>
 
Reply With Quote
 
 
 
 
rob merritt
Guest
Posts: n/a
 
      4th Apr 2005
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>



(E-Mail Removed) (rob merritt) wrote in message news:<(E-Mail Removed)>...
> 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>
> <aspetailsView ID="DetailsView1" Runat="server"
> AutoGenerateDeleteButton="False"
> AutoGenerateEditButton="True"
> DataSourceID="AccessDataSource2" DataKeyNames="acctCode"
> AutoGenerateInsertButton="False"
> onitemupdated="DetailsView1_ItemUpdated" >
> </aspetailsView>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Package a oldb Connection? =?Utf-8?B?QnJpYW4=?= Microsoft VB .NET 1 3rd Dec 2004 04:08 PM
Updating Multiple table Dataset and Back to DataSource shiv Microsoft ADO .NET 0 22nd Oct 2003 06:32 PM
ComboBox.DataSource .Net v1.1.4322: Problem to assign new datasource Stephan Microsoft Dot NET Framework 3 10th Oct 2003 08:09 AM
Not updating objects when changing datasource Annica Lilienberg Microsoft Excel Discussion 1 26th Aug 2003 10:38 PM
cast datagrid.datasource to dataset (datasource is table) newsgroper@yahoo.com Microsoft Dot NET Framework Forms 1 4th Jul 2003 04:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:17 PM.