Re: Best Practices

From: David Browne (meat_at_hotmail.com)
Date: 05/26/04


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



Relevant Pages

  • Re: command timeout does not work
    ... I tried both ways either by Executing through the command object or by ... > How do you execute your SP? ... >> any of the stored procedures. ... >> SET NOCOUNT ON is set in both Stored procedures. ...
    (microsoft.public.data.ado)
  • Extreme performance issues (SQL Server 2000/ADO.NET/C#)
    ... same exact stored procedures and views, run in the same exact order, through ... system that runs SQL Server (a 4-cpu Xeons system with 2gigs of physical ... When I execute these steps manually through query analyser,, ...
    (microsoft.public.sqlserver.server)
  • Sybase, JDBC, AutoCommit, DDL IN TRAN
    ... having executing Sysbase stored procedures via JDBC. ... stored procedure which contains DDL and with AutoCommit set to false I ... The explanation for this behaviour I have found is that the JDBC ... I need to be able to set AutoCommit to false and execute multiple ...
    (comp.lang.java.databases)
  • Re: Sybase, JDBC, AutoCommit, DDL IN TRAN
    ... > having executing Sysbase stored procedures via JDBC. ... > stored procedure which contains DDL and with AutoCommit set to false I ... > The explanation for this behaviour I have found is that the JDBC ... > I need to be able to set AutoCommit to false and execute multiple ...
    (comp.lang.java.databases)
  • Re: Records lost in an ADOStoredProc
    ... Use a thread to fire off the stored procedures so that your application ... Let's suppose it updates ... > the CacheSize is set to 1; it is worse when I increase the CacheSize. ... > I don't need to show records, only to execute the store procedure. ...
    (borland.public.delphi.database.ado)

Loading