B
Big Daddy
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
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