日期:2014-05-17 浏览次数:20924 次
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace JMOA
{
public partial class dmclass : Form
{
SqlConnection conn = new SqlConnection("server=.;uid=sa;pwd=12345;database=JMOA");
SqlDataAdapter dtd;
DataSet ds;
DataView dv;//表示用于排序、筛选、搜索、编辑和导航的System.Data.DataTable+的可绑定数据的自定义视图
public dmclass()
{
InitializeComponent();
}
private void GetData(int pid, TreeNode pnode)
{
dv = ds.Tables[0].DefaultView;//获取可能包括筛选视图或游标位置的表的自定义视图
dv.RowFilter = "pid=" + pid;
int dvC = dv.Count;
if (pnode == null)
{
int i = 0;
while (i < dvC)
{
dv = ds.Tables[0].DefaultView;
dv.RowFilter = "pid=" + pid;
TreeNode node = new TreeNode();
node.Text = dv[i]["name"].ToString();