使用第三个参数绑定数据源 [英] Binding datasources with third Parameters

查看:58
本文介绍了使用第三个参数绑定数据源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SqlCommand cmd = new SqlCommand("Select date from datetime", cn);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet(); 
Binding b = new Binding("Value", ds, "date", true);
datetimepicker1.DataBindings.Add(b);



给出错误无法将数据日期绑定或添加属性" date"到数据源"



Give an error " Cant bind or add properties ''date'' to datasource"

推荐答案

这是通过编程方式进行绑定的方法:

This is how to do binding programmatically :

Binding binding = new Binding("ActualWidth")
       {
         Source = this
       };
ParentSearchGrid.SetBinding(DataGrid.RowHeaderWidthProperty, binding);




在您的情况下,数据集不具有日期类型的属性,也不具有依赖项属性.




In your case dataset does not have a property of type date, nor is it a dependency property.


这篇关于使用第三个参数绑定数据源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆