Click here to Skip to main content
15,894,539 members
Home / Discussions / Database
   

Database

 
AnswerRe: Reset Forgotten Login Password Pin
nilschaudhari28-Nov-11 18:55
nilschaudhari28-Nov-11 18:55 
Questionbackup and restore on sql-server-2008 Pin
Gali197826-Nov-11 5:30
Gali197826-Nov-11 5:30 
AnswerRe: backup and restore on sql-server-2008 Pin
Eddy Vluggen26-Nov-11 6:28
professionalEddy Vluggen26-Nov-11 6:28 
JokeConnect to the database with more than one single layer. Pin
baymyo25-Nov-11 22:09
baymyo25-Nov-11 22:09 
GeneralRe: Connect to the database with more than one single layer. Pin
Luc Pattyn26-Nov-11 3:48
sitebuilderLuc Pattyn26-Nov-11 3:48 
GeneralRe: Connect to the database with more than one single layer. Pin
Richard MacCutchan26-Nov-11 4:00
mveRichard MacCutchan26-Nov-11 4:00 
GeneralRe: Connect to the database with more than one single layer. Pin
Luc Pattyn26-Nov-11 4:31
sitebuilderLuc Pattyn26-Nov-11 4:31 
AnswerMy vote of 2 Pin
Eddy Vluggen26-Nov-11 6:18
professionalEddy Vluggen26-Nov-11 6:18 
C#
internal MCommand(object command, MConnection connection)
       {
           try
           {
               this.m_Connection = connection;
               switch (connection.ClientProvider)
               {
                   case MClientProvider.MSSQL:
                       this.m_ClientCommand = new MSSQLCommand(command as System.Data.SqlClient.SqlCommand);
                       break;
                   case MClientProvider.ORACLE:
                       this.m_ClientCommand = new ORACLECommand(command as System.Data.OracleClient.OracleCommand);
                       break;
                   case MClientProvider.MySQL:
                       break;
                   case MClientProvider.OleDb:
                       this.m_ClientCommand = new OLEDBCommand(command as System.Data.OleDb.OleDbCommand);
                       break;
               }
               this.m_ClientCommand.Connection = connection;
               this.m_CommandText = this.m_ClientCommand.CommandText;
               this.m_CommandType = this.m_ClientCommand.CommandType;
               this.m_CommandTimeout = this.m_ClientCommand.CommandTimeout;
           }
           catch (Exception ex)
           {
               throw ex;
           }

Loose the switch, and have the connection create[^] a command;
C#
command = connection.CreateCommand();

It'd also be wise to remove the redunant error-handler. Catching an exception merely to rethrow it doesn't make much sense. If you really feel like it, then make it
C#
catch (Exception ex)
{
    throw;
}

Bastard Programmer from Hell Suspicious | :suss:

GeneralRe: Connect to the database with more than one single layer. Pin
Jörgen Andersson26-Nov-11 10:51
professionalJörgen Andersson26-Nov-11 10:51 
Questioni need help Pin
niara 25-Nov-11 0:49
niara 25-Nov-11 0:49 
AnswerRe: i need help Pin
Luc Pattyn25-Nov-11 1:46
sitebuilderLuc Pattyn25-Nov-11 1:46 
AnswerRe: i need help Pin
mahsa shahi1-Mar-14 7:18
mahsa shahi1-Mar-14 7:18 
QuestionPostgres 9.1 and C# app Pin
Aleonis24-Nov-11 21:58
Aleonis24-Nov-11 21:58 
AnswerRe: Postgres 9.1 and C# app Pin
Bernhard Hiller24-Nov-11 23:51
Bernhard Hiller24-Nov-11 23:51 
GeneralRe: Postgres 9.1 and C# app Pin
Aleonis25-Nov-11 0:12
Aleonis25-Nov-11 0:12 
GeneralRe: Postgres 9.1 and C# app Pin
Mycroft Holmes25-Nov-11 0:52
professionalMycroft Holmes25-Nov-11 0:52 
GeneralRe: Postgres 9.1 and C# app Pin
Aleonis25-Nov-11 1:13
Aleonis25-Nov-11 1:13 
GeneralRe: Postgres 9.1 and C# app Pin
Mycroft Holmes25-Nov-11 12:30
professionalMycroft Holmes25-Nov-11 12:30 
GeneralRe: Postgres 9.1 and C# app Pin
Aleonis25-Nov-11 22:24
Aleonis25-Nov-11 22:24 
QuestionUsing database Pin
idbee2k322-Nov-11 5:22
idbee2k322-Nov-11 5:22 
AnswerRe: Using database Pin
R. Giskard Reventlov22-Nov-11 23:11
R. Giskard Reventlov22-Nov-11 23:11 
AnswerRe: Using database Pin
Simon_Whale22-Nov-11 23:49
Simon_Whale22-Nov-11 23:49 
AnswerRe: Using database Pin
Satheesh154623-Nov-11 6:08
Satheesh154623-Nov-11 6:08 
GeneralRe: Using database Pin
Peter_in_278023-Nov-11 13:10
professionalPeter_in_278023-Nov-11 13:10 
Questioncharacter found after end of sql statement Pin
chandru7021-Nov-11 23:36
chandru7021-Nov-11 23:36 

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.