Connecting with remote server
-
i m trying to configure db in remote server through C# , locally it is configuring but in Remote Server db is is not creating. Following is the code public bool createDB(object sServerName, String sDBName,object sAdminUname,object sAdminPwd) { object objServerName; objServerName = sServerName; SQLDMO.SQLServer gSQLServerDMO = new SQLDMO.SQLServer(); SQLDMO.Database nDatabase = new SQLDMO.Database(); SQLDMO.DBFile nDBFileData = new SQLDMO.DBFile(); SQLDMO.LogFile nLogFile = new SQLDMO.LogFile(); try { gSQLServerDMO.Connect(objServerName, sAdminUname, sAdminPwd); nDatabase.Name = sDBName; nDBFileData.Name = sDBName; nDBFileData.PhysicalName = gSQLServerDMO.Registry.SQLDataRoot + "\\DATA\\" + sDBName + "_Data.mdf"; nDBFileData.PrimaryFile = true; nDBFileData.Size = 2; nDBFileData.FileGrowthType = SQLDMO.SQLDMO_GROWTH_TYPE.SQLDMOGrowth_MB; nDBFileData.FileGrowth = 1; //Adding DBFile object nDatabase.FileGroups.Item("PRIMARY").DBFiles.Add(nDBFileData); nLogFile.Name = sDBName + "_Log"; nLogFile.PhysicalName = gSQLServerDMO.Registry.SQLDataRoot + "\\DATA\\" + sDBName + "_Log.ldf"; nLogFile.Size = 2; nDatabase.TransactionLog.LogFiles.Add(nLogFile); gSQLServerDMO.Databases.Add(nDatabase); return true; } catch (Exception sqlDBException) { String errSqlDBexception = sqlDBException.Message; return false; } finally { gSQLServerDMO.DisConnect(); } } //Section for creating the database login and user in the above created Database.// public bool Createdatabaselogin(String sDataSource, string databsename, String sScriptName, String sUserId, String sPwd, string loginName, string loginpass) { try { string sqlConnectionString = "Data Source=" + sDataSource + ";Initial Catalog=" + databsename + ";USER ID=" + sUserId + "; PWD=" + sPwd + ";Persist Security Info=True"; SqlConnection conn = new SqlConnection(sqlConnectionString); Server ser