Re: Best Practices
From: David Browne (meat_at_hotmail.com)
Date: 05/26/04
- Next message: Paul Clement: "Re: Retrieve Schema Information by Using GetOleDbSchemaTable"
- Previous message: JJKane: "Search a DataTable on a byte[] field"
- In reply to: TIBM: "Best Practices"
- Next in thread: TIBM: "RE: Best Practices"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 26 May 2004 13:13:02 -0500
"TIBM" <anonymous@discussions.microsoft.com> wrote in message
news:7F80E544-6519-433B-BB29-CFB3B691565F@microsoft.com...
> Hi. I asked this question on another newsgroup, but with no luck...
>
> I'm doing a .Net conversion project. Before, I was using VB6.0 and Oracle
for a 3 tier architecture.
> An important part of the conversion is moving a large number of Oracle
stored procedure to VB.NET; the reason is that they containt too much
business logic. This is an example of how a stored procedure looked like:
>
Why would you want to do that? That's what stored procedures are for.
PL/SQL is a better language for expressing business logic that VB.NET
ADO.NET. If you can come up with a throughly object oriented design for
your application, you may be able to express the business logic better in VB
than you can in PL/SQL. Even then it would be slower.
Rewriting oracle stored procedures in VB.NET will just result in slower,
more complicated and harder to maintain code.
> Should I use datasets or should I use datareaders?
You should use strongly-typed datasets for all your tables. This gives you
intellisense for your columns, automatic type conversions, compile-time type
safety and more compact and efficient expressions.
> Should I execute the select statements (the cursors) at the beginning of
the >function, or should I execute them in the "middle" of the function?
Get what you need when you need it.
> Do I use the same datareader for all the select statements (eg call
>ExecuteReader on the same datareader with different command object - or
>maybe the same command object with a different command string)?
No. Create new ones.
> Should I use stored procedures for selecting, inserting and deleting from
the >database instead of doing it from the function?
No. You should use stored procedures to encapsulate business logic, not to
wrapper trivial SQL statements.
> How do I deal with nulls?
System.DbNull
David
- Next message: Paul Clement: "Re: Retrieve Schema Information by Using GetOleDbSchemaTable"
- Previous message: JJKane: "Search a DataTable on a byte[] field"
- In reply to: TIBM: "Best Practices"
- Next in thread: TIBM: "RE: Best Practices"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|