-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSqlConnectionCommand.cs
40 lines (32 loc) · 1.17 KB
/
SqlConnectionCommand.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System;
using System.Data.SqlClient;
using System.Windows.Forms;
namespace RealEstateDB
{
class SqlConnectionCommand
{
public static SqlConnection sqlconnSystemConnection;
//This Method returns the command container to carry SQL statement to be executed
public static SqlCommand getCommand()
{
sqlconnSystemConnection = openSQLConnection();
SqlCommand cmdContainer = sqlconnSystemConnection.CreateCommand();
return cmdContainer;
}
//This Method returns an SQL connection with the database
public static SqlConnection openSQLConnection()
{
SqlConnection sqlConnection1 = new SqlConnection();
sqlConnection1.ConnectionString = "Server=srdb.cpm0af6q6ase.us-east-2.rds.amazonaws.com,1433;Persist Security Info = true;User ID = SimplisticRealstate;Password= Srdatabase123";
try
{
sqlConnection1.Open();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
return sqlConnection1;
}
}
}