Commit c5aa5620a171f7d321e68ede7dc1799285ccf83a
1 parent
6af76ba3
opening connection before assigning to SQLCommand
Showing
1 changed file
with
7 additions
and
7 deletions
400-SOURCECODE/AIAHTML5.API/Models/DBModel.cs
@@ -328,8 +328,8 @@ namespace AIAHTML5.API.Models | @@ -328,8 +328,8 @@ namespace AIAHTML5.API.Models | ||
328 | { | 328 | { |
329 | conn = new SqlConnection(dbConnectionString); | 329 | conn = new SqlConnection(dbConnectionString); |
330 | cmd = new SqlCommand(); | 330 | cmd = new SqlCommand(); |
331 | - cmd.Connection = conn; | ||
332 | conn.Open(); | 331 | conn.Open(); |
332 | + cmd.Connection = conn; | ||
333 | cmd.CommandText = DBConstants.UPDATE_USER_PASSWORD; | 333 | cmd.CommandText = DBConstants.UPDATE_USER_PASSWORD; |
334 | cmd.CommandType = CommandType.StoredProcedure; | 334 | cmd.CommandType = CommandType.StoredProcedure; |
335 | cmd.Parameters.AddWithValue("@sLoginId", loginId); | 335 | cmd.Parameters.AddWithValue("@sLoginId", loginId); |
@@ -483,8 +483,8 @@ namespace AIAHTML5.API.Models | @@ -483,8 +483,8 @@ namespace AIAHTML5.API.Models | ||
483 | { | 483 | { |
484 | conn = new SqlConnection(dbConnectionString); | 484 | conn = new SqlConnection(dbConnectionString); |
485 | cmd = new SqlCommand(); | 485 | cmd = new SqlCommand(); |
486 | - cmd.Connection = conn; | ||
487 | conn.Open(); | 486 | conn.Open(); |
487 | + cmd.Connection = conn; | ||
488 | cmd.CommandText = DBConstants.UPDATE_LICENSE_TERM_STATUS; | 488 | cmd.CommandText = DBConstants.UPDATE_LICENSE_TERM_STATUS; |
489 | cmd.CommandType = CommandType.StoredProcedure; | 489 | cmd.CommandType = CommandType.StoredProcedure; |
490 | cmd.Parameters.AddWithValue("@sAccountNumber", accountNumber); | 490 | cmd.Parameters.AddWithValue("@sAccountNumber", accountNumber); |
@@ -543,8 +543,8 @@ namespace AIAHTML5.API.Models | @@ -543,8 +543,8 @@ namespace AIAHTML5.API.Models | ||
543 | { | 543 | { |
544 | conn = new SqlConnection(dbConnectionString); | 544 | conn = new SqlConnection(dbConnectionString); |
545 | cmd = new SqlCommand(); | 545 | cmd = new SqlCommand(); |
546 | - cmd.Connection = conn; | ||
547 | conn.Open(); | 546 | conn.Open(); |
547 | + cmd.Connection = conn; | ||
548 | cmd.CommandText = DBConstants.INSERT_LOGIN_DETAIL; | 548 | cmd.CommandText = DBConstants.INSERT_LOGIN_DETAIL; |
549 | cmd.CommandType = CommandType.StoredProcedure; | 549 | cmd.CommandType = CommandType.StoredProcedure; |
550 | cmd.Parameters.AddWithValue("@iUserId", userId); | 550 | cmd.Parameters.AddWithValue("@iUserId", userId); |
@@ -572,8 +572,8 @@ namespace AIAHTML5.API.Models | @@ -572,8 +572,8 @@ namespace AIAHTML5.API.Models | ||
572 | { | 572 | { |
573 | conn = new SqlConnection(dbConnectionString); | 573 | conn = new SqlConnection(dbConnectionString); |
574 | cmd = new SqlCommand(); | 574 | cmd = new SqlCommand(); |
575 | - cmd.Connection = conn; | ||
576 | conn.Open(); | 575 | conn.Open(); |
576 | + cmd.Connection = conn; | ||
577 | cmd.CommandText = DBConstants.INSERT_INCORRECT_LOGIN_ATTEMPTS; | 577 | cmd.CommandText = DBConstants.INSERT_INCORRECT_LOGIN_ATTEMPTS; |
578 | cmd.CommandType = CommandType.StoredProcedure; | 578 | cmd.CommandType = CommandType.StoredProcedure; |
579 | cmd.Parameters.AddWithValue("@iUserId", userId); | 579 | cmd.Parameters.AddWithValue("@iUserId", userId); |
@@ -637,8 +637,8 @@ namespace AIAHTML5.API.Models | @@ -637,8 +637,8 @@ namespace AIAHTML5.API.Models | ||
637 | { | 637 | { |
638 | conn = new SqlConnection(dbConnectionString); | 638 | conn = new SqlConnection(dbConnectionString); |
639 | cmd = new SqlCommand(); | 639 | cmd = new SqlCommand(); |
640 | - cmd.Connection = conn; | ||
641 | conn.Open(); | 640 | conn.Open(); |
641 | + cmd.Connection = conn; | ||
642 | cmd.CommandText = DBConstants.UPDATE_INCORRECT_LOGIN_ATTEMPTS; | 642 | cmd.CommandText = DBConstants.UPDATE_INCORRECT_LOGIN_ATTEMPTS; |
643 | cmd.CommandType = CommandType.StoredProcedure; | 643 | cmd.CommandType = CommandType.StoredProcedure; |
644 | cmd.Parameters.AddWithValue("@iUserId", userId); | 644 | cmd.Parameters.AddWithValue("@iUserId", userId); |
@@ -665,8 +665,8 @@ namespace AIAHTML5.API.Models | @@ -665,8 +665,8 @@ namespace AIAHTML5.API.Models | ||
665 | { | 665 | { |
666 | conn = new SqlConnection(dbConnectionString); | 666 | conn = new SqlConnection(dbConnectionString); |
667 | cmd = new SqlCommand(); | 667 | cmd = new SqlCommand(); |
668 | - cmd.Connection = conn; | ||
669 | conn.Open(); | 668 | conn.Open(); |
669 | + cmd.Connection = conn; | ||
670 | cmd.CommandText = DBConstants.DELETE_INCORRECT_LOGIN_ATTEMPTS; | 670 | cmd.CommandText = DBConstants.DELETE_INCORRECT_LOGIN_ATTEMPTS; |
671 | cmd.CommandType = CommandType.StoredProcedure; | 671 | cmd.CommandType = CommandType.StoredProcedure; |
672 | cmd.Parameters.AddWithValue("@iUserId", userId); | 672 | cmd.Parameters.AddWithValue("@iUserId", userId); |
@@ -724,8 +724,8 @@ namespace AIAHTML5.API.Models | @@ -724,8 +724,8 @@ namespace AIAHTML5.API.Models | ||
724 | { | 724 | { |
725 | conn = new SqlConnection(dbConnectionString); | 725 | conn = new SqlConnection(dbConnectionString); |
726 | cmd = new SqlCommand(); | 726 | cmd = new SqlCommand(); |
727 | - cmd.Connection = conn; | ||
728 | conn.Open(); | 727 | conn.Open(); |
728 | + cmd.Connection = conn; | ||
729 | cmd.CommandText = DBConstants.INSERT_LOGIN_ERROR_LOG; | 729 | cmd.CommandText = DBConstants.INSERT_LOGIN_ERROR_LOG; |
730 | cmd.CommandType = CommandType.StoredProcedure; | 730 | cmd.CommandType = CommandType.StoredProcedure; |
731 | cmd.Parameters.AddWithValue("@nvAccountNumber", accountNumber); | 731 | cmd.Parameters.AddWithValue("@nvAccountNumber", accountNumber); |