4141using System . Data ;
4242using System . Data . SqlClient ;
4343using System . Diagnostics ;
44+ using System . Drawing ;
4445using System . IO ;
4546using System . Reflection ;
4647using System . Text ;
@@ -156,18 +157,18 @@ private void PopulateObjects(string serverName, string databaseName)
156157 // sys.schemas and sys.assemblies tables we step through our SMO database object. This is efficient
157158 // enough - even on large databases - but it allows us to use the Scripter object to script objects
158159 // based on the URN returned.
159- Server srv ;
160+ Server server ;
160161
161162 if ( chkUseWindowsAuthentication . Checked )
162163 {
163- srv = new Server ( txtServerName . Text ) ;
164+ server = new Server ( txtServerName . Text ) ;
164165 }
165166 else
166167 {
167- srv = new Server ( new ServerConnection ( txtServerName . Text , txtUsername . Text , txtPassword . Text ) ) ;
168+ server = new Server ( new ServerConnection ( txtServerName . Text , txtUsername . Text , txtPassword . Text ) ) ;
168169 }
169170
170- Database db = srv . Databases [ ddlDatabases . SelectedItem . ToString ( ) ] ;
171+ Database database = server . Databases [ ddlDatabases . SelectedItem . ToString ( ) ] ;
171172
172173 // RS: Set the DataTable up so we're all ready to add data to it
173174 allobjects = null ;
@@ -184,7 +185,7 @@ private void PopulateObjects(string serverName, string databaseName)
184185 DataTable allobjectsenum = new DataTable ( ) ;
185186 toolStripStatusLabel1 . Text = "Enumerating objects in database..." ;
186187 Application . DoEvents ( ) ;
187- allobjectsenum = db . EnumObjects ( ) ;
188+ allobjectsenum = database . EnumObjects ( ) ;
188189
189190 toolStripProgressBar1 . Value = 0 ;
190191 toolStripProgressBar1 . Maximum = allobjectsenum . Rows . Count ;
@@ -232,11 +233,11 @@ private void PopulateObjects(string serverName, string databaseName)
232233 // DataTable. NOTE: We don't need to update the clbSchema list box, as the schema that the table
233234 // that "owns" the trigger is inferred on the trigger. I think. Does that make sense to anyone besides
234235 // me?
235- foreach ( Table tbl in db . Tables )
236+ foreach ( Table table in database . Tables )
236237 {
237- foreach ( Trigger trg in tbl . Triggers )
238+ foreach ( Trigger trg in table . Triggers )
238239 {
239- allobjects . Rows . Add ( new object [ ] { false , tbl . Schema . ToString ( ) , trg . Name . ToString ( ) , "Trigger" , trg . Urn . ToString ( ) } ) ;
240+ allobjects . Rows . Add ( new object [ ] { false , table . Schema . ToString ( ) , trg . Name . ToString ( ) , "Trigger" , trg . Urn . ToString ( ) } ) ;
240241 }
241242 }
242243
@@ -268,13 +269,13 @@ private void PopulateObjects(string serverName, string databaseName)
268269
269270 dgAvailableObjects . DataSource = allobjectsview ;
270271
271- foreach ( DataGridViewRow dgr in dgAvailableObjects . Rows )
272+ foreach ( DataGridViewRow dataGridViewRow in dgAvailableObjects . Rows )
272273 {
273274 // RS: Some more chunky clbType populating code...saves us the hassle of having to add it when
274275 // we're populating, as we don't know whether or not we have triggers until later.
275- if ( ( ! clbType . Items . Contains ( dgr . Cells [ 3 ] . Value . ToString ( ) ) ) && ( dgr . Cells [ 3 ] . Value . ToString ( ) != string . Empty ) )
276+ if ( ( ! clbType . Items . Contains ( dataGridViewRow . Cells [ 3 ] . Value . ToString ( ) ) ) && ( dataGridViewRow . Cells [ 3 ] . Value . ToString ( ) != string . Empty ) )
276277 {
277- clbType . Items . Add ( dgr . Cells [ 3 ] . Value . ToString ( ) ) ;
278+ clbType . Items . Add ( dataGridViewRow . Cells [ 3 ] . Value . ToString ( ) ) ;
278279 }
279280 }
280281
@@ -296,6 +297,8 @@ private void PopulateObjects(string serverName, string databaseName)
296297 dgAvailableObjects . Columns [ 2 ] . Width = 316 ;
297298 dgAvailableObjects . Columns [ 3 ] . Width = 200 ;
298299 toolStripStatusLabel1 . Text = "Ready" ;
300+ dgAvailableObjects . RowsDefaultCellStyle . BackColor = Color . Bisque ;
301+ dgAvailableObjects . AlternatingRowsDefaultCellStyle . BackColor = Color . Beige ;
299302 }
300303
301304 private SqlConnection GetConnection ( string databaseName )
0 commit comments