Another Salesforce blog!!!

Salesforce, Apex

C#

Check to see whether the file in a url Exists or Not

You can use HttpWebRequest. Note four things 1) The webRequest will throw exception if the link doesn’t exist 2) You may like to disable auto redirect 3) You may also like to check if it’s a valid url. If not, it will throw UriFormatException. 4) Per Paige suggested , Use “Head” in request.Method so that […]

ExecuteNonQuery / ExecuteScalar

Namespaces: System.Data; System.Xml; System.Configuration; // Clear out any test records from previous test executions. using (System.Data.SqlClient.SqlConnection connection = new System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings[“DB_NAME”].ConnectionString)) { connection.Open(); string _mediaId = string.Empty; string _title = “Title”; using (System.Data.SqlClient.SqlCommand cmd = connection.CreateCommand() as System.Data.SqlClient.SqlCommand) { System.Data.SqlClient.SqlCommand cmd1 = new System.Data.SqlClient.SqlCommand(sql, connection); cmd1.CommandType = CommandType.Text; using (System.Data.SqlClient.SqlDataReader reader = cmd1.ExecuteReader()) { while (reader.Read()) […]

Extract substring from a string until finds a comma c# asp.net