//配置服务器
CouchbaseClientConfiguration mbcc = new CouchbaseClientConfiguration();
//使用默认的数据库
mbcc.Urls.Add(new Uri("http://10.10.10.37:8091/pools/default")); //建立一个Client,装入Client的配置
CouchbaseClient client = new CouchbaseClient(mbcc);
string str = "{\"POIInfo\":\"" + pair.Value.Pguid.ToString() + "_" + (m++).ToString() + "_" + (n++).ToString() + "_" + ixx.ToString() + "\",\"original\":\"" + poi.OriginalWord + "\","
+ "\"pguid\":\"" + poi.Pguid + "\",\"originalpinyin\":\"" + poi.OriginalPinyin + "\",\"originalfirstchar\":\"" + poi.OriginalFirstChar + "\",\"type\":\"" + poi.Type + "\","
+ "\"longitude\":\"" + poi.Longitude + "\",\"latitude\":\"" + poi.Latitude + "\",\"areacode\":\"" + poi.AreaCode + "\",\"poitype\":\"" + poi.POIType + "\",\"typeboost\":\""
+ "" + poi.TypeBoost.ToString() + "\",\"frequencyboost\":\"" + poi.FrequencyBoost.ToString() + "\",\"name\":\"" + derive.DeriveName + "\",\"derive\":\"" + entry.Replace(" ", "").Replace("|", " ").ToLower() + "\","
+ "\"pinyinderive\":\"" + entry.ToLower() + "\",\"firstchar\":\"" + GetFirstChar(entry) + "\"}"; var json =JsonConvert.DeserializeObject(str); string output = JsonConvert.SerializeObject(json);
//添加一条数据
bool b = client.Store(StoreMode.Add, "" + pair.Value.Pguid.ToString() + "_" + (suffix++).ToString() + "", output);想查出部分属性,并显示。
CouchbaseClientConfiguration mbcc = new CouchbaseClientConfiguration();
//使用默认的数据库
mbcc.Urls.Add(new Uri("http://10.10.10.37:8091/pools/default")); //建立一个Client,装入Client的配置
CouchbaseClient client = new CouchbaseClient(mbcc);
string str = "{\"POIInfo\":\"" + pair.Value.Pguid.ToString() + "_" + (m++).ToString() + "_" + (n++).ToString() + "_" + ixx.ToString() + "\",\"original\":\"" + poi.OriginalWord + "\","
+ "\"pguid\":\"" + poi.Pguid + "\",\"originalpinyin\":\"" + poi.OriginalPinyin + "\",\"originalfirstchar\":\"" + poi.OriginalFirstChar + "\",\"type\":\"" + poi.Type + "\","
+ "\"longitude\":\"" + poi.Longitude + "\",\"latitude\":\"" + poi.Latitude + "\",\"areacode\":\"" + poi.AreaCode + "\",\"poitype\":\"" + poi.POIType + "\",\"typeboost\":\""
+ "" + poi.TypeBoost.ToString() + "\",\"frequencyboost\":\"" + poi.FrequencyBoost.ToString() + "\",\"name\":\"" + derive.DeriveName + "\",\"derive\":\"" + entry.Replace(" ", "").Replace("|", " ").ToLower() + "\","
+ "\"pinyinderive\":\"" + entry.ToLower() + "\",\"firstchar\":\"" + GetFirstChar(entry) + "\"}"; var json =JsonConvert.DeserializeObject(str); string output = JsonConvert.SerializeObject(json);
//添加一条数据
bool b = client.Store(StoreMode.Add, "" + pair.Value.Pguid.ToString() + "_" + (suffix++).ToString() + "", output);想查出部分属性,并显示。
解决方案 »
- datagridview 多出一列rowstat,求救如何去除
- axwebbrowser求指点
- 跪求,一个对字符串的特殊算法
- 运用程序域谁能讲解一下
- 如何用滑动条控制c#窗口颜色
- c# keybd_event按住某键出问题
- 为什么我的DataGridView的ColumnIndex是乱的?
- 问一下关于数据库read-only的问题
- 综合类,前沿技术问题(2005+2005)
- 给一些控件添加事件,如果用属性页窗口自动添加的,则代码会自动添加到Form1.Designer.cs中,如果手动添加,我是放在Form的构造函数里呢还是
- 麻烦哪位高手帮忙看下这段加密程序,详细的解释一下作用和过程。
- 【WPF右键菜单】禁用和调用右键系统菜单
if (json[0] != '[')
json = "[" + json;
if (json[json.Length - 1] != ']')
json = json + "]"; JavaScriptSerializer jss = new JavaScriptSerializer();
ArrayList arrList = jss.Deserialize<ArrayList>(json);
if (arrList.Count > 0)
{
foreach (Dictionary<string, object> arr in arrList)
{
foreach (string key in arr.Keys)
{
//key就是属性
//arr[key]就是对应的属性值
}
}
}
//使用默认的数据库
mbcc.Urls.Add(new Uri("http://10.10.10.37:8091/pools/default")); //建立一个Client,装入Client的配置
CouchbaseClient client = new CouchbaseClient(mbcc);
client.get("key");//查询
时候可以用JSon文件里面的属性列来查询???