ListView how to make some columns Read-only - asp.net-3.5

I am replacing a Gridview with a ListView as I needed Insert functionality. My DAL has all the code set up for Insert, Update, Delete & Select.
When I put my datasource in the ListView properties, it created a the templates for me in the aspx files.
However, expect for the Primary Key filed all fields are editable. I did change the Textbox to a lable & changed #Bind to #Eval. I get an run-time error. It caomplains about not finding a Update function with required parameters. It is passing all the fileds as parameters to my Update function.
My column structure is
MainID, SubID, Name, Size.
My SQL statement is
UPDATE table1 SET Name = #Name, Size = #Size WHERE (MainID = #original_MainID)
In my DAL, I have a UPDATE function that updates only Name & Size based on MainID. How can I make SubID read-only & not pass it to my Update function?
I need to add a dropdownlist for the column Name. The dropdownlist needs to be bound to another SQL table. Can this be done?

Related

ms access form listbox changing whole field

I have created a form to update a query that that is in turn based on a master table containing information on a number of files. This master table is then related to several other tables in say for example a table called group_table, defining which group the file would belong to, which contains an ID field and the group_name. This is then related in a one-to-many relationship with the master table based on the group.ID and a field in the master table master_table.group and joined in the query the form is based on.
In the form I have designated a listbox control to update the group field of the query/master table. The contents available for selection in the list box were set based on the group_name field from the group_table table which is defined in the RowSouce section of the property sheet of the form.
So my issue is that when I try and update any records in the query using the listbox in the form, all of the records that are the same will get changed as well. E.g., changing a record in one row from "Group A" to "Group B" will change all the records containing "Group A" to "Group B" in the group field. So I was wondering if there is anything I can do to set it so only the specific record that I want to change gets changed.
When you are making the call to update the table you should make sure that you are using WHERE along with the primary key to make sure that you update that row only. An example would be a statement similar to the one below.
CurrentDb.Execute "UPDATE [group_table] AS G INNER JOIN [master_table] AS M
ON G.[ID] = M.[groupID]
SET G.[group] = '"& Group A & "'
WHERE M.[groupID] = '" & groupIDFromForm & "';"
Apply the ON from the join so that the foreign key and primary key are going to share the same value, and from there use the form to create a variable that you can use to identify the exact row. From there the program should execute the query correctly.

How to hide record in Form grid based on display method value?

I have a simple Form, in my DataSource I created a classic displayMethod (named calculateAmount) and use this metodod to show the value in Form's grid.
So It's possible to show only record having a specific value from calculateAmount , for example I want to show only record having calculateAmount() > 0 , other record with calculated calculateAmount() < 0 not show.
So if I can't mix Query and displayMethod, possibly where I can insert the condition (for example active executeQuery etc) ?
Thanks in advice.
Consider the following sequence:
Execute query is called and the AOT query is translated into SQL query
Results are fetched from SQL server after executeQuery()
Display method is called for each record and then the values are shown on grid
So you cannot add query range on execute query based on display method value.
One thing you can do:
Duplicate your datasource table and set its Table Type property to TempDB
In executeQuery method write the logic to fill this new created table
Here you can add this condition like this:
if ([your data source].calculateAmount() > 0)
{
// do not add the record in temp table
}
else
{
// add the record in temp table
}
Set your temp table as the datasource to your grid.
Hope this helps!!

Filemaker: Copy Global Variable from a Related Table?

I have a parent table that contains a global variable named gStartDate.
In a child table I have placed a global variable with the identical name. It has a calculated value:
ParentTable::gStartDate
However, it appears that it never copies the date from ParentTable::gStartDate. How can I correct this?
Thanks in advance to all for any info.
Its sounds like you set the calculated field in the child table to use "global" storage. That isn't going to update unless you update the schema or create a new record in the child table.
What you want is to set the calculated field to in the child table to be "un-stored". That will update when it is needed. And when it does it will pull the correct result from the parent table.
See the image.

How do I ignore the created column on a Zend_DB table save?

how would I ignore having Zend_DB save() from trying to fill out a created column? I do not need that column for a certain model.
Don't send the data. save() is part of the Zend_Db_Table_Row api and is designed to be somewhat intelligent in the way it saves data to a row. It will perform an insert or an update of a row depending on what is required.
save() will also only update the columns that it has data for. If you don't send new data for your created column save() won't overwrite the data.
When ever it is possible I let the database I'm using create and update the columns for created and updated. That way I have the information available to query if I need it but I don't have to do something with PHP that My database can do better.
Check out http://framework.zend.com/manual/1.12/en/zend.db.table.html Section "Advanced usage".
For more specific and optimized requests, you may wish to limit the
number of columns returned in a row or rowset. This can be achieved by
passing a FROM clause to the select object. The first argument in the
FROM clause is identical to that of a Zend_Db_Select object with the
addition of being able to pass an instance of Zend_Db_Table_Abstract
and have it automatically determine the table name.
Important
The rowset contains rows that are still 'valid' - they simply contain
a subset of the columns of a table. If a save() method is called on a
partial row then only the fields available will be modified.
So, if you called an update() I think it would be as simple as unsetting the value for the column you don't want to touch. Of course database constraints will need to be honored - i.e. column should allow nulls.

Axapta: Programmatically switch records in a form

In Dynamics AX 2009, how do you programmatically change to a different record in a form?
My form contains a treeview and a group of bound data fields. When clicking on a record in the tree (the data value for each item in the tree is the RecId of the item I'd like to edit in the form) I'd like to change the form to that record.
I've been using sysSetupForm as an example for working with a tree, but I'm having trouble isolating where the call to change records occurs in their code.
Thanks
Some example:
some_table table;
;
table = some_table:find(recid);
table_ds.findRecord(table); // it's a form datasource method