@@ -106,7 +106,7 @@ private void PopulateDatabases(string serverName)
106106 ddlDatabases . Items . Clear ( ) ;
107107 try
108108 {
109- SqlConnection connection = GetConnection ( "tempdb" ) ;
109+ SqlConnection connexion = GetConnection ( "tempdb" ) ;
110110 Server server = new Server ( serverName ) ;
111111
112112 // Check if we're using 2005 or higher
@@ -117,13 +117,13 @@ private void PopulateDatabases(string serverName)
117117
118118 ddlDatabases . Items . Add ( "(Select a database)" ) ;
119119
120- foreach ( Database db in server . Databases )
120+ foreach ( Database database in server . Databases )
121121 {
122122 // RS: Update the progress bar
123123 toolStripProgressBar1 . Value ++ ;
124- if ( ! db . IsSystemObject && db . IsAccessible )
124+ if ( ! database . IsSystemObject && database . IsAccessible )
125125 {
126- ddlDatabases . Items . Add ( db . Name ) ;
126+ ddlDatabases . Items . Add ( database . Name ) ;
127127 }
128128 }
129129
@@ -322,24 +322,24 @@ private SqlConnection GetConnection(string databaseName)
322322 return sqlConnection ;
323323 }
324324
325- private string GetConnectionString ( string databaseName )
325+ private string GetConnectionString ( string databaseName , bool useWindowsAuthentication , string userName , string password )
326326 {
327- SqlConnectionStringBuilder csb = new SqlConnectionStringBuilder ( ) ;
328- csb . DataSource = txtServerName . Text ;
329- if ( chkUseWindowsAuthentication . Checked )
327+ SqlConnectionStringBuilder sqlConnectionStringBuilder = new SqlConnectionStringBuilder ( ) ;
328+ sqlConnectionStringBuilder . DataSource = databaseName ;
329+ if ( useWindowsAuthentication )
330330 {
331- csb . IntegratedSecurity = true ;
331+ sqlConnectionStringBuilder . IntegratedSecurity = true ;
332332 }
333333 else
334334 {
335- csb . IntegratedSecurity = false ;
336- csb . UserID = txtUsername . Text ;
337- csb . Password = txtPassword . Text ;
335+ sqlConnectionStringBuilder . IntegratedSecurity = false ;
336+ sqlConnectionStringBuilder . UserID = userName ;
337+ sqlConnectionStringBuilder . Password = password ;
338338 }
339339
340- csb . InitialCatalog = databaseName ;
341- csb . ApplicationName = "Scriptio" ;
342- return csb . ConnectionString ;
340+ sqlConnectionStringBuilder . InitialCatalog = databaseName ;
341+ sqlConnectionStringBuilder . ApplicationName = "Scriptio" ;
342+ return sqlConnectionStringBuilder . ConnectionString ;
343343 }
344344
345345 private void DdlDatabases_SelectedIndexChanged ( object sender , EventArgs e )
0 commit comments