|
Did you bind the datagrid. Update is, if I remember, to put changes made in the data grid back into the database.
|
|
|
|
|
Desktop App, not web...No databind() for this object
Jude
|
|
|
|
|
|
OK - check this out. I just ran a simple test to comfirm something. Here is what I did step by step.
1) Create new project(Windows Application).
2) Dragged a sqlDataAdapter onto the form.
3) Went through the wizard (create new connection, use sql statements, query builder, chose table, chose all columns.
4) Generate Dataset.
5) Dragged DataGrid onto form.
6) Set the Datasource property of the datagrid to the dataset.table
7) Added sqlDataAdapter.Fill to the load method of the form.
Worked fine.
I am doing the same with the project in question. The only difference is in the SELECT Statement. I am joining two tables into the data set and it is a stored procedure.
Jude
|
|
|
|
|
Hi,
We have implemented a Windows c# application using a typed dataset (ADO.NET)
I've modified the relation so the childs get deleted when the parent is deleted. Delete action: cascade.
In the function where I process all the changes in the dataset (Dataset.GetChanges()),
I create for every table 1 adapter & call the .Update() function.
When the first adapter (for parent) is created & called the .Update() function, the parent and all its childs are deleted due to the relationship (Delete action: cascade)
A few lines further on, the adapter of the childs are called and the .Update() function throws an exception because the child is already deleted on the DB! This is very ennoying and I really don't know how to solve this problem.
Any idea how to solve this? I tested it out with my own SqlCommand object and the deletion of the parent & childs did not cause any problems.
I'd really love to keep the relationship so the childs get deleted automatically. This allows me to write less code
Best regards,
Jens
|
|
|
|
|
|
Hi,
Performing the updates in the correct order is not a good solution aswell.
I have put the table adapter update of parent at the end, but this comes with another problem.
Let's say you have to create the parent, the table adapter needs to first do the inserts of the parents, otherwise the children won't be added because of the relationship!
Any other solutions?
Best regards,
Jens
|
|
|
|
|
Perhaps I was not clear enough in my previous post. When updating a data source containing multiple related tables, you should update in this order:
1. ChildTable Deleted Records
2. New, Modified, and Deleted ParentTable Records
3. New ChildTable Records
4. Modified ChildTable Records
This order ensures that updates can be performed properly, taking into account the relationship between the tables.
The link in my previous post will walk you through how to update records based on their status (Added, Modified, Deleted).
Hope this helps.
|
|
|
|
|
i wnat to create a backup from a database in local my SQL Server(2000)
to the another computer on the network.
for this reason i define a backup device with Sp_addumpdevice stord procdure
and device create successfully but when execute the command
(Backup database GrantBooks to MyDeviceName )in the Query analyzer i give message that backup database perform successfully but the backup not exist
on the device path and backup not created.
what i do for this problem?
thanks a lot.
CuttingEdge
|
|
|
|
|
Friendz,
Is there any way where in I can delete a column(s) from DataTable programatically in .NET 2005.
Regards,
Vipul Mehta
Regards,
Vipul Mehta
Software Engineer
Chenoa Information & Software Services Pvt Ltd
|
|
|
|
|
DataTable.Columns.Remove("ColumnName") or DataTable.Columns.Remove(ColumnIndex) or
DataTable.Columns.RemoveAt(ColumnIndex)
|
|
|
|
|
Hi,
I have the following table:
Name Value
---- -----
Paul NULL
Mary NULL
Paul 0
What query can I use to detect Mary (the only one that has no values), but not Paul?
thanx
|
|
|
|
|
Hi please confirm if this is what you want
SELECT * FROM DUMMY WHERE name IN (SELECT Name FROM Dummy GROUP BY Name HAVING COUNT(Name) = 1)
Svt
|
|
|
|
|
<br />
select Name<br />
from table<br />
where value is null<br />
and name not in<br />
(select Name<br />
from table<br />
where value is not null)<br />
Mike Lasseter
|
|
|
|
|
When I type this in a command window: aspnet_regsql -S localhost -E -d MyComics –ed
I get "The argument -ed is invalid".
Any ideas why? I am running this against a sql 2005 database.
|
|
|
|
|
This option is for SQL Server 7.0 or 2000. You don't need to configure a database for a cache dependency in SQL Server 2005 - this is a native feature of the database server.
See [^] for information on getting SqlCacheDependency working on SQL Server 2005.
|
|
|
|
|
DB: SQL Server 2000
I am having trouble writing a SQL statement to pull the most current data about a record out of a table and would appreciate if someone could shed some light on the situation. Example tables below:
<br />
tbl_Item<br />
ItemID<br />
Color<br />
Type<br />
CreatedDate<br />
CreatedBy<br />
<br />
<br />
tbl_ItemValue<br />
ValueID<br />
ItemID<br />
Value<br />
UpdatedDate<br />
UpdatedBy<br />
Everytime the value changes for an item, as new record is created in the tbl_ItemValue table. I need to create a query that joins the two tables and shows the most current value for each item in the tbl_Item table. Most current value would be the record with the most current UpdatedDate that has the same ItemID in tbl_ItemValue. Therefore, my view should look something like this:
<br />
vw_Item_Value_Current<br />
ItemID<br />
Color<br />
Type<br />
CreatedDate<br />
CreatedBy<br />
Value<br />
UpdatedDate<br />
UpdatedBy
Any help would greatly be appreciated.
|
|
|
|
|
Here's one way:
select * from tbl_Item itm
inner join tbl_ItemValue val on itm.itemid = val.itemid
inner join (Select max(updateddate) as MaxDate, itemid
from tbl_itemValue
group by itemid) as val2 on val.UpdatedDate = val2.MaxDate and val.ItemID = val2.ItemID
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
Thanks for the help. That worked.
|
|
|
|
|
when i use oledb connection with following connectionstring, i can connect to SQL SERVER named DOCTOR
"Provider=SQLOLEDB.1;Persist Security Info=False;User ID=SA;Initial Catalog=LASEREPI;Data Source=DOCTOR"
but when i use SQLCLIENT.SQLCONNECTION with following string, i cant connect what is missing?:S
"Persist Security Info=False;User ID=SA;Initial Catalog=LASEREPI;Data Source=DOCTOR"
|
|
|
|
|
greekius@hotmail.com wrote: i cant connect what is missing?:
A password?
|
|
|
|
|
DON"T CROSS POST YOUR QUESTIONS
only two letters away from being an asset
|
|
|
|
|
Hi,
I think this will help to u
Cstring="Server=<systemname>;DataBase=DOCTOR;UID=sa;PWD="
Pandian S
|
|
|
|
|
greekius@hotmail.com wrote: ;User ID=SA;
Your connecting to a database using SA?
That is VERY unsecure! Highly unrecommended.
Connection strings http://www.connectionstrings.com/[^]
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
hello every one,
well I'm working on making a master detail form here. I've binded the data correctly and now I want to add the update, del, and insert new record functionality to the detail form. I'm using .net 2.0 C# and I'm working in windows Forms. I've used DataGridView class to display the detail data information.
For saving the record, I wanted to cast the datasource of DataGridView into a datatable first and then use it to iterate thru the data but it returns a null so I get the nullreferenceException. Plz tell me how to iterate thru the detail table here.
I actually deleted a few columns from the detail table ;like the PK columns and Foreign Key columns coz the user doesnt need to see those. But I do wanna have access to those esp when updatin the record. So what can I do.
if its possible plz give me a sample code or application if u can.
thanks in advance...
Rocky
|
|
|
|