Hi Smita,
Here is a sample C# code to call stored procedure.All logic is in button1_click()
I have also put a screen shot of the stored procedure here,
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.Odbc;
using System.Data.SqlClient;
using System.Diagnostics;
namespace HANAConnectionTest
{
public partial class Form1 : Form
{
String strCommand = @"call ""_SYS_BIC"".""mytestproject.procedures/test_insert"" ( )";
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
SqlDataReader rdr = null;
SqlCommand cmd = null;
OdbcCommand command = null;
OdbcDataReader reader = null;
bool read;
object[] meta = new object[14];
String strConn = "DRIVER={HDBODBC};UID=<userID>;PWD=<password>;SERVERNODE=<serveraddress>:30015;DATABASE=SYSTEM";
OdbcConnection hanaConn = new OdbcConnection(strConn.ToString());
try
{
hanaConn.Open();
command = hanaConn.CreateCommand();
Debug.WriteLine("Executing Command : " + strCommand);
command.CommandText = strCommand;
reader = command.ExecuteReader();
if (reader.Read() == true)
{
do
{
int NumberOfColums = reader.GetValues(meta);
for (int i = 0; i < NumberOfColums; i++)
Console.Write("{0} ", meta[i].ToString());
Console.WriteLine();
read = reader.Read();
} while (read == true);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
finally
{
hanaConn.Dispose();
}
}
private void button2_Click(object sender, EventArgs e)
{
if (IntPtr.Size == 8)
{
MessageBox.Show("64-Bit System");
MessageBox.Show(strCommand);
}
else
MessageBox.Show("32 Bit System");
}
}
}
Here is the actual stored procedure. Basically, the procedure uses a sequence I created, and creates a new entry in the table. Of course, we can pass the values to be inserted, as parameters into stored procedure from C# too.
Here is the run result
Hope it helps.
Best Regards,
Gopal Nair.

