求高手帮我写一个菜单TreeView绑写数据库 by:asp.net(C#)

来源:百度知道 编辑:UC知道 时间:2024/06/06 10:03:33
表结构如下:

一类表 menu:
id(ID)
name(一类名称)
sout(排序)
二类表 menu_1:
id(ID)
menuid(一类ID)
name(二类名称)
sout(排序)

单击子节点传递"一类ID"&"二类ID"。谢谢!
二楼的大哥,能不能给完整的代码啊,我刚学!谢谢!

还是不行,你用的是哪个版本的啊.
我的是2008的..
GetTypeHashCode()”: 没有找到适合的方法来重写

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace WindowsApplication5
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

//从数据库中读取数据函数.
public DataTable GetRecordSet(string sql)
{
DataTable dt = new DataTable();

//第二个参数为数据库连接字符串,根据不同你要做适当修改
SqlDataAdapter da = new SqlDataAdapter(sql, "Data Source=BRILLIANCE-LCG;Initial Catalog=Northwind;Integrated Security=True");
DataSet ds = new DataSet();
da.Fill(ds);

dt = ds.Tables[0];

return dt;
}

private void Form1_Load(object sender, EventArgs e)
{
//获取menu的信息保存到dt1
DataTable dt1 = GetRecordSet("select * from menu");

//