To format string literals in C#, use the String.Format method.In the following example, 0 is the index of the object whose string value gets inserted at that particular position −using System; namespace Demo { class Test { static void Main(string[] args) { decimal A = 15.2 m; string res = String.Format("Temperature = {0}°C.", A); Console.WriteLine(res); } } }In the following example, let us format string for double type.Example Live Demousing System; class Demo { public static void Main(String[] args) { ... Read More
To format output in C#, let us see examples to format date and double type.Set formatted output for Double type.Example Live Demousing System; class Demo { public static void Main(String[] args) { Console.WriteLine("Three decimal places..."); Console.WriteLine(String.Format("{0:0.000}", 987.383)); Console.WriteLine(String.Format("{0:0.000}", 987.38)); Console.WriteLine(String.Format("{0:0.000}", 987.7899)); Console.WriteLine("Thousands Separator..."); Console.WriteLine(String.Format("{0:0, 0.0}", 54567.46)); Console.WriteLine(String.Format("{0:0, 0}", 54567.46)); } }OutputThree decimal places... 987.383 987.380 987.790 Thousands Separator... 54, 567.5 54, 567Set formatted output for DateTimeExample Live Demousing System; static class Demo { static void Main() ... Read More
Declare a list.List < string > l = new List < string > ();Now, add elements to the list.// elements l.Add("Accessories"); l.Add("Footwear"); l.Add("Watches");Now convert it into a string.string str = string.Join(" ", l.ToArray());Let us see the final code to convert a list to string in C# −Exampleusing System; using System.Collections.Generic; class Demo { static void Main() { List < string > l = new List < string > (); // elements l.Add("Accessories"); l.Add("Footwear"); l.Add("Watches"); string str = string.Join(" ", l.ToArray()); Console.WriteLine(str); } }
To print duplicates from a list of integers, use the ContainsKey.Below, we have first set the integers.int[] arr = { 3, 6, 3, 8, 9, 2, 2 };Then Dictionary collection is used to get the count of duplicate integers.Let us see the code to get duplicate integers.Example Live Demousing System; using System.Collections.Generic; namespace Demo { public class Program { public static void Main(string[] args) { int[] arr = { 3, 6, ... Read More
Each HANA system contains multiple serves inside, which are responsible to perform different functions. Index Server is heart of SAP HANA system which contains SQL/MDX processor for handling SQL statements. Key component includes −Index ServerPreprocessorName ServerStatistics ServerHANA XS EngineSAP Host AgentSAP Solution Manager Diagnostic AgentSAP HANA Studio + RepositorySAP HANA Software Update Manager SUM
We have set an array and a dictionary to get the distinct elements.int[] arr = { 88, 23, 56, 96, 43 }; var d = new Dictionary < int, int > ();Dictionary collection allows us to get the key and value of a list.The following is the code to display distinct elements of a given integer array −Example Live Demousing System; using System.Collections.Generic; namespace Demo { public class Program { public static void Main(string[] args) { int[] arr = { 88, ... Read More
When a remote source is added, you can see all the existing tables under that data source in HANA Studio. Next is to create virtual table mapping to data in the remote data sources in SAP HANA Studio. This can be done using GUI option.To add a table as a virtual table, you need to navigate to remote data source → Schema name → Table name → Right-click and Add as Virtual TableBelow shows how you can add a table as a Virtual Table using HANA Studio.
The following is our array −int[] arr = new int[] { 7, 4, 6, 2 };Let’s say the given intger that should be equal to sum of two other integers is −int res = 8;To get the sum and find the equality.for (int i = 0; i < arr.Length; i++) { for (int j = 0; j < arr.Length; j++) { if (i != j) { int sum = arr[i] + arr[j]; if (sum == res) { Console.WriteLine(arr[i]); ... Read More
When you create a new remote data source, SAP HANA Smart data access parse the respective property configuration file. With the use of config file- features, function mappings, data type mappings, and other properties will be linked together with the data source. This decides the communication between the SAP HANA and the data source.You can see part of the content of property_orcl.ini shown below −
You can check the following example to create a new remote source −CREATE REMOTE SOURCE TEST_11g ADAPTER “odbc” CONFIGURATION FILE ‘property_orcl.ini’ CONFIGURATION ‘DSN=oral11g_lnx’ WITH CREDENTIAL TYPE ‘PASSWORD’ USING ‘user=username;password=password′;In above SQL statement, can be one of − ASEODBC, IQODBC,TDODBC, HIVEODBC,ODBC. Obviously, ASEODBC is for Sybase ASE as data source, IQODBC is for Sybase IQ, TDODBC is for Teradata Database, HIVEODBC is for Hadoop.
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP