我想使用
SqlDataAdapter控件中的SelectCommand的SourceColumn,不知如何使用,请教一下高手!
            myCommand.SelectCommand.Parameters.Add(new SqlParameter("@SerialNumber", SqlDbType.VarChar));
            myCommand.SelectCommand.Parameters["@SerialNumber"].SourceVersion = DataRowVersion.Current;
            myCommand.SelectCommand.Parameters["@SerialNumber"].SourceColumn = "SerialNumber";下面不知如何变量绑定到对应的dataset去。。

解决方案 »

  1.   

    Gets or sets the name of the column within the data source to map from. The name is case-sensitive. Namespace: System.Data.Common
    Assembly: System.Data (in system.data.dll)value = instance.SourceColumninstance.SourceColumn = value
     
    C# 
    public string SourceColumn { get; set; }
     
     
    C# 
    public void CreateDataColumnMapping() 
    {
        DataColumnMapping mapping = new DataColumnMapping();
        mapping.SourceColumn = "Description";
        mapping.DataSetColumn = "DataDescription";