Click here to Skip to main content
15,881,803 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi,
I am new to Couchbase Server c#.Net and i need help in learning it.
I have already installed the setup file.
I have some queries please help me to solve this

1.Able to create the Bucket in http://localhost:8091/index.html but want to know how to create the tables in it.
2.How to insert a data into a single or multiple tables at once.
3.How to get the data from the couchbase server using c#.

Please provide a link having web services (C#) example that uses couchbase as a DB.

Thank you all in advance
Posted
Updated 15-Dec-15 3:49am
v3

This is a Quick Answers forum and it sounds like you need a tutorial.

Couchbase has a full set of documentation[^] which includes First App walk through and a Developer forum.

The above link should be your starting point. Do come back if you hit a specific problem and we will try to help
 
Share this answer
 
Comments
ravithejag 15-Dec-15 9:54am    
I have created a sample program that inserts Employee details into the Employee Bucket
public List<employee> GetEmployees()
{
return new List<employee>()
{
new Employee{Id=1,Name="aaa",Age=28,Designation="Developer"},
new Employee{Id=2,Name="bbb",Age=25,Designation="Developer"},
new Employee{Id=3,Name="ccc",Age=25,Designation="Developer"},
new Employee{Id=4,Name="ddd",Age=25,Designation="Developer"},
};
}

ClusterHelper.GetBucket(CouchbaseConfigHelper.Instance.Bucket).Upsert("Employee:", GetEmployees());

Data got inserted to the Employee Bucket Successfully.
But i am unable to retrieve the data from that bucket
Please find the code
var query = "SELECT name FROM Employee";

var data = ClusterHelper
.GetBucket(CouchbaseConfigHelper.Instance.Bucket)
.Query<dynamic>(query)
.Rows;
CHill60 15-Dec-15 10:02am    
So what actually happens when you run that query?
Is the database case-sensitive (in which case use SELECT Name FROM Employee)
ravithejag 15-Dec-15 10:16am    
Its returning null

This is data present in the document

[
{
"id": 1,
"name": "Kirti",
"age": 28,
"designation": "Developer"
},
{
"id": 2,
"name": "Ravi G",
"age": 25,
"designation": "Developer"
},
{
"id": 3,
"name": "Madhavi",
"age": 25,
"designation": "Developer"
},
{
"id": 4,
"name": "Niveditha",
"age": 25,
"designation": "Developer"
}
]
ravithejag 15-Dec-15 10:23am    
when i query SELECT name FROM `Employee` in n1ql command getting no primary index is present .
Can i know how to solve this
BillWoodruff 15-Dec-15 11:26am    
Why don't you edit your original post to include the code, and be sure and format it. It's very likely your code will be ignored if posted in comments, like this.
Forgot to create primary index on the table

CREATE PRIMARY INDEX `Employee-index` ON `Employee` USING GSI;


C#
var query =new QueryRequest("SELECT * FROM `Employee`");
var data = ClusterHelper
        .GetBucket(CouchbaseConfigHelper.Instance.Bucket)
        .Query<dynamic>(query)
        .Rows;
 
Share this answer
 
v2
Comments
BillWoodruff 15-Dec-15 11:25am    
Please do not post code that should be shown in your original post as a solution. Edit your original post to include the code, and make sure it's formatted, as you do, here.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900