object xyz = cmd.ExecuteScalar().ToString(); if (xyz != null) {YOURURL = xyz.ToString();blah blah blah blah... never get to this cause i get the same error as soon as i use executescalar. }
string sql = "Select Shorttext from Picklist where Text = '" + country + "' and PicklistID = 'Country'";
Sage.Entity.Interfaces.IContact contact = this.BindingSource.Current as Sage.Entity.Interfaces.IContact;string CountryDialCode ="";if (contact.Address.Country != null){string country = contact.Address.Country;Sage.Platform.Data.IDataService _dataService = ParentWorkItem.Services.Get();string sql = "Select Shorttext from Picklist where Text = '" + country + "' and PicklistID = 'kSYST0000388'";using (System.Data.OleDb.OleDbConnection conn = (System.Data.OleDb.OleDbConnection)_dataService.GetConnection()){conn.Open();System.Data.IDbCommand cmd = conn.CreateCommand();cmd.CommandText = sql;object xyz = cmd.ExecuteScalar().ToString(); if (xyz != null) { CountryDialCode = xyz.ToString(); }}}if (contact != null){DialButton2.OnClientClick = string.Format("window.open('http://api.aptela.com/callback?u=XXXXXUSER&g=XXXGROUP&n=011"+ CountryDialCode +"%20{0}');", contact.Mobile);}