本文介绍了从Dataset获取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
ObjInvoice.PaymentMode =? 如果我使用的功能
public DataSet GetPaymentMode( string CompanyId) { OleDbCommand cmdPermission = new OleDbCommand(); if (Conn.State!= ConnectionState.Open) { Conn.Open(); } DataSet ds = new DataSet(); cmdPermission.CommandText = 从Company_Master中选择PaymentTerm,其中CompanyID = + CompanyId + ; cmdPermission.CommandType = CommandType.Text; cmdPermission.Connection = Conn; cmdPermission.ExecuteNonQuery(); OleDbDataAdapter adap = new OleDbDataAdapter(cmdPermission); if (Conn.State == ConnectionState.Open) { Conn.Close(); } // adap.Fill(ds); return ds; }解决方案
看起来问题是不完整的Ashutosh。 你想尝试访问GetPaymentMode方法并尝试在该情况下将该值填充到ObjInvoice.PaymentMode而不是数据集作为方法GetPaymentMode的返回参数,您应该遍历数据集并返回ObjInvoice.PaymentMode字段所属类型的值。
ObjInvoice.PaymentMode = ? If I use function
public DataSet GetPaymentMode(string CompanyId) { OleDbCommand cmdPermission = new OleDbCommand(); if (Conn.State != ConnectionState.Open) { Conn.Open(); } DataSet ds = new DataSet(); cmdPermission.CommandText = "SELECT PaymentTerm from Company_Master where CompanyID=" + CompanyId + ""; cmdPermission.CommandType = CommandType.Text; cmdPermission.Connection = Conn; cmdPermission.ExecuteNonQuery(); OleDbDataAdapter adap = new OleDbDataAdapter(cmdPermission); if (Conn.State == ConnectionState.Open) { Conn.Close(); } //adap.Fill(ds); return ds; } 解决方案 Well looks like the question is incomplete Ashutosh. Are you trying to access GetPaymentMode method and trying to fill that value into the ObjInvoice.PaymentMode in that case instead of the dataset as return parameter of your method GetPaymentMode you should traverse the dataset and return the value of whatever type the ObjInvoice.PaymentMode field is.更多推荐
从Dataset获取数据
发布评论