如何在datagridview中将两个数据库列设置为一行 [英] how to set two database columns to one row in datagridview
本文介绍了如何在datagridview中将两个数据库列设置为一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用此代码我将列0设置为Kundnr_Id,但我还要包含我在数据库中的ForNamn列
像这样但我不工作为什么?
任何建议?
.DataPropertyNam =Kundnr_ID+ForNamn;
Using this code i set Column 0 to Kundnr_Id but i would also to include the ForNamn column that i have in my database
Like this but i doesnt work why?
Any Suggestions?
.DataPropertyNam="Kundnr_ID"+"ForNamn";
dataGridView1.Columns[0].DataPropertyName = "Kundnr_ID";
dataGridView1.Columns[0].Name = "Kundnr";
dataGridView1.Columns[0].HeaderText = "Kundnr";
推荐答案
您不能将单个列设置为两个不同的数据源:您需要使用两个单独的列,每个数据库字段一个。
You can't set a single column to two different datasources: you need to use two separate columns, one for each database field.
这篇关于如何在datagridview中将两个数据库列设置为一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文