sql - Dynamic menu binding using oledb in asp.net -
if using sql server database in asp.net dynamic menu binding shows menus , submenus items on page.but on other side if use oracle database menu binding not shows menu items on page.it shows menu control blank @ run time
sql connectivity
try { response.cache.setcacheability(httpcacheability.nocache); dataset ds = new dataset(); string connstr = "server=webserver;uid=sa;pwd=sa;database=amit;"; using (sqlconnection conn = new sqlconnection(connstr)) { string sql = "select menuid, subheadname, description, parentid, url menumaster typeno '%" + session["user_type"].tostring().trim() + "%' , prno not null"; sqldataadapter da = new sqldataadapter(sql, conn); da.fill(ds); da.dispose(); } ds.datasetname = "menus"; ds.tables[0].tablename = "menu"; datarelation relation = new datarelation("parentchild", ds.tables[0].columns["menuid"], ds.tables[0].columns["parentid"], false); relation.nested = true; ds.relations.add(relation); xmldatasource.data = ds.getxml(); } catch { response.redirect("error.aspx"); }
oracle connectivity
try response.cache.setcacheability(httpcacheability.nocache) dim constr string = system.configuration.configurationmanager.connectionstring("connectionstring").connectionstring dim ds dataset = new dataset() using conn new oledbconnection(constr) dim str string = "select menuid, subheadname,description, parentid,url dtl_menumaster prno not null order menuid" dim da oledbdataadapter = new oledbdataadapter(str, conn) da.fill(ds) da.dispose() end using ds.datasetname = "menus" ds.tables(0).tablename = "menu" dim relation datarelation = new datarelation("parentchild", ds.tables(0).columns("menuid"), ds.tables(0).columns("parentid"), true) relation.nested = true ds.relations.add(relation) xmldatasource.data = ds.getxml() catch ex exception end try
Comments
Post a Comment