关于datagridview代码,求指教???
private void btnSearch_Click(object sender, EventArgs e)
{
Dictionary<string, string[]> searchRst = new Dictionary<string, string[]>();
for (int i = 0; i < cmbServices.Items.Count; i++)
{
string stype = cmbServices.Items[i].ToString();
Kingtop.Esoso.ServicesSite ss = GetServiceSite(stype);
string lsResult = lss.GetPoi(Kingtop.Esoso.ServicesSite.MapBar, textBox3.Text, textBox1.Text);
Kingtop.Esoso.LsSvcPoiRst lspr = (Kingtop.Esoso.LsSvcPoiRst)Newtonsoft.Json.JavaScriptConvert.DeserializeObject(lsResult, typeof(Kingtop.Esoso.LsSvcPoiRst));
if (lspr == null || lspr.state == false)
{
//Error
}
else
{
Kingtop.Esoso.Poi[] pary = lspr.data;
string[] aryRst = null;
searchRst.Add(stype, aryRst);
}
//转换为datatable,并绑定
DataTable dt = new DataTable();
dt.Columns.Add("方法", typeof(String));
dt.Columns.Add("关键字", typeof(String));
dt.Columns.Add("潜力", typeof(String));
dt.Columns.Add("POI", typeof(String));
dt.Columns.Add("名称", typeof(String));
dt.Columns.Add("地址", typeof(String));
dt.Columns.Add("区划代码", typeof(String));
for (int i = 1; i < ********; i++)
{
string[] data = lspr.data;
DataRow dr = dt.NewRow();
dr[0] = "名址匹配";
dr[1] = textBox1.Text;
dr[2] = "名称";
dr[3] = "名称";
dr[4] = **********;
dr[5] = **********;
dr[6] = **********;
dt.Rows.Add(dr);
}
this.dataGridView2.DataSource = dt;
}
}
------解决方案--------------------
说清楚想干嘛