Re: I have two questions about the TableAdapter Configuration Wizard
- From: "Big Daddy" <johngilmer@xxxxxxxxx>
- Date: 11 Dec 2006 14:11:55 -0800
Thanks,
Does anyone have any ideas on question #2 from my original post?
Cor Ligthert [MVP] wrote:
Big Daddy,
Be aware that a where clause is nice, but as long as a row does not change,
the dataadapter (which the tableadapter inherits from) does never give a row
to the database to update.
To add to the designer created class you can add a partial clase where you
can put all your delete transact code in. You are than even able to recreate
the designer generated part.
I hope this gives some ideas,
Cor
"Big Daddy" <johngilmer@xxxxxxxxx> schreef in bericht
news:1165594247.650561.161200@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
1. I have a table in the database (SQL Server) that I created an
adapter for using Visual Studio 2005. It has
select/insert/delete/update methods created, but not using stored
procedures, because I check the option that says:
Create methods to send updates directly to the database
(GenerateDBDirectMethods)
The INSERT sql that is created by the wizard is:
INSERT INTO [Patients] ([PatientId]) VALUES (@PatientId);
But I want the INSERT sql to be:
INSERT INTO [Patients] ([PatientId]) VALUES (@PatientId); select * from
Patients WHERE (PatientNo = @@IDENTITY)
Because there's an identity autonumber in the table that I want to read
back into my DataTable after in the insert. So I manually added the
text
select * from Patients WHERE (PatientNo = @@IDENTITY)
To the insert statement. Is there any way to make the wizard
automatically add this to the INSERT statement so I don't have to do it
manually?
2. I want to have a TableAdapter that encapsulates a bunch of stored
procedures, but that doesn't have a DataTable that goes with it. For
example, I might have 10 delete sprocs that I want to put into one
TableAdapter. When I create a new TableAdapter, I select the radio
button "use existing stored procedures". It forces me to have a SELECT
sproc, even though none of the sprocs I want to put in the adapter is a
SELECT. So if I choose a SELECT sproc first, it creates a DataAdapter
and DataTable for me. Then I can add all of my DELETE sprocs that I
want to. But I don't want the DataTable or the SELECT query at all. I
just want to put in a bunch of DELETE sprocs. Is there any way to do
what I want?
Thanks in advance,
John
.
- Follow-Ups:
- Re: I have two questions about the TableAdapter Configuration Wizard
- From: William \(Bill\) Vaughn
- Re: I have two questions about the TableAdapter Configuration Wizard
- References:
- I have two questions about the TableAdapter Configuration Wizard
- From: Big Daddy
- Re: I have two questions about the TableAdapter Configuration Wizard
- From: Cor Ligthert [MVP]
- I have two questions about the TableAdapter Configuration Wizard
- Prev by Date: ADO.NET not exposing maxlength even though the data exists
- Next by Date: Re: I have two questions about the TableAdapter Configuration Wizard
- Previous by thread: Re: I have two questions about the TableAdapter Configuration Wizard
- Next by thread: Re: I have two questions about the TableAdapter Configuration Wizard
- Index(es):
Loading