Search code examples
c#cassandracassandra-driver

Query Cassandra form C# no result is shown


I am trying to run the query form my local machine using console as below

select state from table limit 10 ALLOW FILTERING;

it's giving me the output.

But when I am trying it form console application I am not getting any result.
Below is the code

  //Create a cluster instance using 3 cassandra nodes.
   var cluster = Cluster.Builder()
   .AddContactPoints("xx.xx.xx.xx")
   .Build();
    var session = cluster.Connect("keyspace");
    var rs = session.Execute("select state from table limit 10 ALLOW FILTERING");
    foreach (var row in rs)
    {
        var value = row.GetValue<string>("state");
    }

Ref: https://docs.datastax.com/en/developer/csharp-driver/3.2/
I am not getting any error as well. I am using "CassandraCSharpDriver"
https://www.nuget.org/packages/CassandraCSharpDriver/


Solution

  • I found the solution the issue is with the driver version. I was using the latest version which is the default.
    I downgraded to 3.11.0 and started working.

    My server version is [cqlsh 5.0.1 | Cassandra 3.11.4 | CQL spec 3.4.4 | Native protocol v4]