title: Batch insert in cassandra using c#
body: <p>I am new in cassandra. I have to insert 50000 rows in one go in cassandra using c#. I am using cassandra c# driver. i am using following code to insert 
  the data in cassandra. Please help me </p>
  
  <pre><code>string tableName = "" + ConfigurationManager.AppSettings["tableName"];
              string keySpace = "test";// "" + ConfigurationManager.AppSettings["Keyspace"];
              //string query = "INSERT INTO " + tableName + " (emp_name, emp_position,emp_firstname,uniqueid) VALUES (?, ?,?,?)"; //; "SELECT * FROM "+ tableName + " limit 2 ";
              string query = string.Empty;
              query =
  "BEGIN BATCH " +
  "INSERT INTO " + tableName + " (emp_name, emp_position,emp_firstname,uniqueid) VALUES (?, ?,?,?);" +
  "INSERT INTO " + tableName + " (emp_name, emp_position,emp_firstname,uniqueid) VALUES (?, ?,?,?);" +
  "INSERT INTO " + tableName + " (emp_name, emp_position,emp_firstname,uniqueid) VALUES (?, ?,?,?);" +
  " APPLY BATCH";
  
  BatchStatement(keySpace, query,
                      Convert.ToString("ashish" + i), 2, Convert.ToString("Mohan" + i), System.Guid.NewGuid(),
                      Convert.ToString("ashish" + i), 2, Convert.ToString("Mohan" + i), System.Guid.NewGuid(),
                      Convert.ToString("ashish" + i), 2, Convert.ToString("Mohan" + i), System.Guid.NewGuid()
  </code></pre>
  
  <pre><code>public void BatchStatement(string keySpace, string query, params object[] parameter)
      {
          try
          {
              BatchStatement objBatchStatement = new BatchStatement();
              PreparedStatement statement = PrepareQueryStatement(keySpace, query);
              objBatchStatement.Add(statement.Bind(parameter));
              var session = cluster.Connect(keySpace);
              //objBatchStatement.ConsistencyLevel
              // Execute the batch
              //RowSet row = session.Execute(query);
              RowSet row = session.Execute(objBatchStatement);
  
          }
          catch (Exception ex)
              {
              Console.WriteLine("Excpetion occured during batch operation method Name BatchStatement error : " + ex.ToString());
          }
  
      }
  </code></pre>
  
  <p>I am getting error : Invalid statement in batch: only UPDATE, INSERT and DELETE statements are allowed.</p>