Click here to Skip to main content
15,921,660 members
Home / Discussions / Database
   

Database

 
GeneralRe: get the newly create record ID Pin
Alexandru Savescu20-Aug-03 0:34
Alexandru Savescu20-Aug-03 0:34 
GeneralRe: get the newly create record ID Pin
Steve S20-Aug-03 0:50
Steve S20-Aug-03 0:50 
GeneralRe: get the newly create record ID Pin
Dr_Sh0ck24-Aug-03 23:52
Dr_Sh0ck24-Aug-03 23:52 
GeneralRe: get the newly create record ID Pin
Tom Archer25-Aug-03 15:41
Tom Archer25-Aug-03 15:41 
GeneralRe: get the newly create record ID Pin
Jerome Conus25-Aug-03 19:02
Jerome Conus25-Aug-03 19:02 
GeneralRe: get the newly create record ID Pin
Tom Archer26-Aug-03 2:00
Tom Archer26-Aug-03 2:00 
QuestionOleDB or Sql? Pin
Alexandru Savescu19-Aug-03 22:28
Alexandru Savescu19-Aug-03 22:28 
AnswerRe: OleDB or Sql? Pin
Brad Sokol22-Aug-03 2:58
Brad Sokol22-Aug-03 2:58 
Everything I've read says the same thing, but I've never seen it quantified.

A solution that gives you some flexibility might be to use the ADO.NET interfaces rather than the concrete classes. Use a factory class to create your connections, data readers, data adapters, etc. and then in your data layer use the interface types, rather than the concrete types to work with the objects.

To change to one of the other 'families' of classes, you only need to change the factory. You can have a factory for SQL Server and one for Oracle (with .NET 1.1). You could even instantiate the factory dynamically at runtime though you'll need a common base class or interface for your factories.

Here is some psuedo-code:

<br />
class SQLServerDataObjectFactory : DataObjectFactory<br />
{<br />
    public IDbConnection CreateConnection(...)<br />
    {<br />
        return new SqlConnection(...);<br />
    }<br />
}<br />
<br />
class OracleDataObjectFactory : DataObjectFactory<br />
{<br />
    public IDbConnection CreateConnection(...)<br />
    {<br />
        // The class name may be wrong - I don't have the .NET 1.1 framework installed<br />
        return new OracleConnection(...);<br />
    }<br />
}<br />
<br />
class MyDataLayerObject<br />
{<br />
    public void MyDataLayerMethod()<br />
    {<br />
        // Do stuff<br />
<br />
        // The data object factory was instantiated somewhere in the <br />
        // program's initialisation code.<br />
        IDbConnection connection = myDataObjectFactory.CreateConnection(...);<br />
<br />
        // Do stuff with connection. At this point, I don't care what<br />
        // concrete type it is.<br />
    }<br />
} <br />
<br />
Brad

GeneralNO_DATA - no error information available Pin
bpchia19-Aug-03 20:10
bpchia19-Aug-03 20:10 
GeneralRe: NO_DATA - no error information available Pin
bpchia22-Aug-03 1:43
bpchia22-Aug-03 1:43 
Generalstumped Pin
Shotgun19-Aug-03 18:34
Shotgun19-Aug-03 18:34 
GeneralRe: stumped Pin
Rocky Moore19-Aug-03 22:58
Rocky Moore19-Aug-03 22:58 
GeneralRe: stumped Pin
Shotgun20-Aug-03 1:44
Shotgun20-Aug-03 1:44 
GeneralHelp with sql trigger Pin
Ista19-Aug-03 11:32
Ista19-Aug-03 11:32 
GeneralRe: Help with sql trigger Pin
Jason McBurney21-Aug-03 4:54
Jason McBurney21-Aug-03 4:54 
GeneralRe: Help with sql trigger Pin
Ista21-Aug-03 4:56
Ista21-Aug-03 4:56 
GeneralRe: Help with sql trigger Pin
Mike Dimmick22-Aug-03 4:04
Mike Dimmick22-Aug-03 4:04 
GeneralRe: Help with sql trigger Pin
Ista22-Aug-03 4:11
Ista22-Aug-03 4:11 
QuestionHELP!!! why it's so hard to insert a row to Database by ADO.NET? Pin
yyf19-Aug-03 9:20
yyf19-Aug-03 9:20 
AnswerRe: HELP!!! why it's so hard to insert a row to Database by ADO.NET? Pin
yyf19-Aug-03 10:25
yyf19-Aug-03 10:25 
GeneralRe: HELP!!! why it's so hard to insert a row to Database by ADO.NET? Pin
Tom Archer25-Aug-03 15:42
Tom Archer25-Aug-03 15:42 
Generalhelp with common ASP/SQL speed issues Pin
kaht19-Aug-03 7:20
kaht19-Aug-03 7:20 
GeneralRe: help with common ASP/SQL speed issues Pin
Jason McBurney21-Aug-03 4:57
Jason McBurney21-Aug-03 4:57 
GeneralRe: help with common ASP/SQL speed issues Pin
Mike Dimmick22-Aug-03 5:04
Mike Dimmick22-Aug-03 5:04 
GeneralRe: help with common ASP/SQL speed issues Pin
kaht25-Aug-03 3:03
kaht25-Aug-03 3:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.