从Dataset获取数据

编程入门 行业动态 更新时间:2024-10-24 02:01:41
本文介绍了从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获取数据

本文发布于:2023-11-26 21:04:13,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1635192.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数据   Dataset

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!