Exemple #1
0
 public DataService()
 {
     RoomGuideDataStructure.DataService dataServiceValue = new RoomGuideDataStructure.DataService();
     dataServiceValue.serverName   = GetConfigValue("ServerName");
     dataServiceValue.userName     = GetConfigValue("UserName");
     dataServiceValue.databaseName = GetConfigValue("Database");
     dataServiceValue.password     = GetConfigValue("Password");
     this.sqlConnection            = this.GetConnection(dataServiceValue);
 }
Exemple #2
0
        private SqlConnection GetConnection(RoomGuideDataStructure.DataService dataService)
        {
            string connectionString = string.Empty;

            try
            {
                connectionString = "Data Source=" + dataService.serverName + "; Initial Catalog=" + dataService.databaseName + ";User ID=" + dataService.userName + ";Password="******";";

                return(new SqlConnection(connectionString));
            }
            catch (Exception connectionException)
            {
                return(new SqlConnection(connectionString));

                throw connectionException;
            }
        }
Exemple #3
0
 public DataService(RoomGuideDataStructure.DataService dataService)
 {
     this.sqlConnection = this.GetConnection(dataService);
 }