我想知道是否有人可以告诉我为什么当我从具有多列的数据集填充我的组合框时,列值之间的每一行中都有空格(大约5个空格)。C# - 从数据集导入后组合框项包含空格
代码
thisConnect.Open();
SqlDataAdapter sqladapt = new SqlDataAdapter("SELECT firstname, lastname, address FROM OwnersTbl", thisConnect);
DataSet ds = new DataSet();
sqladapt.Fill(ds, "OwnersTbl");
thisConnect.Close();
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
comboBoxOwners.Items.Add(ds.Tables[0].Rows[i][0] + "" + ds.Tables[0].Rows[i][1] + "" + ds.Tables[0].Rows[i][2]);
}
因为你在数据库中使用char而不是varchar数据类型? – 2013-04-07 20:52:04