February 13, 2006 at 1:51 am
Hi
I have a couple of tables, in the first table I want to add new records and in the second I want to first delete all the records and then insert a set of new records.
Using dataAdapters do I need 1 per table or 1 per sqlcommand
or would it be better to drop the second table and recreate it? How do I do this using ADO.NET?
Code examples appriciated.
Thanks
February 14, 2006 at 7:52 am
Hi David,
Do you specifically need to use DataAdapters. If not consider using a Connection object and a command object to execute stored procedures
e:g
SqlConnection cnn = new SqlConnection("Connection String");
SqlCommand cmd = new SqlCommand("spDoSomething",cnn);
cmd.Commandtype = Command.StoredProcedure;
cnn.open();
cmd.ExecuteNonQuery();
cnn.close();
Quis custodiet ipsos custodes.
February 14, 2006 at 2:48 pm
Hi Shaun & David
Assuming that it is not essential to use a Dataadapter, I think Shauns suggestion is a good one!
Just a comment, in respect to the SP spDoSomething - I am told for performance reasons it is better to name User Defined SP's with the first two letters NOT sp as I think SQL Server will first look in the Master DB for that SP if it has a name like sp....
So, consider naming your SP's like proc......
Anyway, just a thought.
Kind regards
Ross Petersen
February 15, 2006 at 5:09 am
Hi Ross & David,
The prefix to avoid is actually 'sp_' because as you say SQL Server will look in the Master db first and therefore slow things down.
A good point!
regards
Shaun
Quis custodiet ipsos custodes.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply