Click here to Skip to main content
15,911,035 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Handling a null value Pin
Yusuf22-Apr-09 14:12
Yusuf22-Apr-09 14:12 
AnswerRe: Handling a null value Pin
Perry Holman22-Apr-09 16:26
Perry Holman22-Apr-09 16:26 
GeneralRe: Handling a null value Pin
Ekjon23-Apr-09 5:15
Ekjon23-Apr-09 5:15 
Questiontree view select all child nodes when to click parent nodes Pin
T_Teef22-Apr-09 9:54
T_Teef22-Apr-09 9:54 
AnswerRe: tree view select all child nodes when to click parent nodes Pin
ToddHileHoffer22-Apr-09 10:03
ToddHileHoffer22-Apr-09 10:03 
QuestionRe: tree view select all child nodes when to click parent nodes Pin
T_Teef22-Apr-09 10:06
T_Teef22-Apr-09 10:06 
AnswerRe: tree view select all child nodes when to click parent nodes Pin
Fayu22-Apr-09 10:10
Fayu22-Apr-09 10:10 
QuestionRe: tree view select all child nodes when to click parent nodes Pin
T_Teef22-Apr-09 10:18
T_Teef22-Apr-09 10:18 
heres the code


public partial class _Default : System.Web.UI.Page
{
    public static SqlConnection sqlConn = new SqlConnection();
    public static SqlCommand sqlCmmd = new SqlCommand();
    public static SqlDataAdapter sqlDAptr = new SqlDataAdapter();
    //public DataSet busDataSet
    //{
    //    get
    //    {
    //        return DS;
    //    }
    //    set
    //    {
    //        DS = value;
    //    }
    //}
    
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            //GetTables();
            PassQuery();
            //abc();
        }
        catch (Exception)
        {
            throw;
        }
    }


    public void PassQuery()
    {
        this.TreeView1.Nodes.Clear();

        DataSet myFirstTable = new DataSet();

        string Query = "select name from sys.tables";
        myFirstTable = Retun_Table_BasedOn_Query(Query);
        DataSet[] mySecondTable = new DataSet[myFirstTable.Tables[0].Rows.Count];

        for (int i = 0; i < myFirstTable.Tables["Table"].Rows.Count; i++)
        {
            string str1 = myFirstTable.Tables["Table"].Rows[i][0].ToString();

            string Query2 = "SELECT  sysobjects.name As Names, syscolumns.name AS FieldName " +
                           "FROM sysobjects INNER JOIN syscolumns ON sysobjects.id = syscolumns.id " +
                           "WHERE (sysobjects.name = '" + str1 + "')";
            mySecondTable[i] = Retun_Table_BasedOn_Query(Query2);
            
            TreeNode tnParent;
            TreeNode tnChild;

            for (int a = 0; a < 1; a++)
            {
                tnParent = new TreeNode();
                tnParent.Text = str1.ToString();
                TreeView1.Nodes.Add(tnParent);

                foreach (DataRow rowChild in mySecondTable[i].Tables["Table"].Rows)
                {
                    tnChild = new TreeNode();
                    tnChild.Text  = rowChild["FieldName"].ToString();
                    tnParent.ChildNodes.Add(tnChild);
                }
            }
        }
    }

    public void Open_Connection()
    {
        string Conn_Str = "Data Source=dev-test;Initial Catalog=Malik;Persist Security Info=True;User ID=interns;Password=intern123";
        sqlConn = new SqlConnection(Conn_Str);
        if (sqlConn.State != ConnectionState.Open)
        {
            sqlConn.Open();
        }
    }

    public DataSet Retun_Table_BasedOn_Query(String Query)
    {
        Open_Connection();
        DataSet mydataSet = new DataSet();
        sqlCmmd = new SqlCommand(Query, sqlConn);
        sqlDAptr = new SqlDataAdapter(sqlCmmd);
        sqlDAptr.Fill(mydataSet);
        return mydataSet;
    }
}


helpConfused | :confused:
AnswerRe: tree view select all child nodes when to click parent nodes Pin
ToddHileHoffer22-Apr-09 10:21
ToddHileHoffer22-Apr-09 10:21 
GeneralRe: tree view select all child nodes when to click parent nodes Pin
T_Teef22-Apr-09 10:44
T_Teef22-Apr-09 10:44 
QuestionUsing Master Page as the DB reader which implements the reading on all child pages [modified] Pin
shabya22-Apr-09 8:20
shabya22-Apr-09 8:20 
AnswerRe: Using Master Page as the DB reader which implements the reading on all child pages Pin
ToddHileHoffer22-Apr-09 9:59
ToddHileHoffer22-Apr-09 9:59 
GeneralRe: Using Master Page as the DB reader which implements the reading on all child pages Pin
shabya23-Apr-09 7:07
shabya23-Apr-09 7:07 
QuestionViewState storing custom class Pin
Fayu22-Apr-09 8:14
Fayu22-Apr-09 8:14 
AnswerRe: ViewState storing custom class Pin
ToddHileHoffer22-Apr-09 9:58
ToddHileHoffer22-Apr-09 9:58 
GeneralRe: ViewState storing custom class Pin
Fayu22-Apr-09 10:08
Fayu22-Apr-09 10:08 
GeneralRe: ViewState storing custom class Pin
ToddHileHoffer22-Apr-09 10:19
ToddHileHoffer22-Apr-09 10:19 
GeneralRe: ViewState storing custom class Pin
Fayu22-Apr-09 14:20
Fayu22-Apr-09 14:20 
GeneralRe: ViewState storing custom class Pin
ToddHileHoffer22-Apr-09 15:16
ToddHileHoffer22-Apr-09 15:16 
GeneralRe: ViewState storing custom class Pin
DoctorMick22-Apr-09 21:51
DoctorMick22-Apr-09 21:51 
GeneralRe: ViewState storing custom class Pin
ToddHileHoffer23-Apr-09 2:13
ToddHileHoffer23-Apr-09 2:13 
GeneralRe: ViewState storing custom class Pin
DoctorMick23-Apr-09 2:30
DoctorMick23-Apr-09 2:30 
GeneralRe: ViewState storing custom class Pin
Fayu23-Apr-09 6:18
Fayu23-Apr-09 6:18 
GeneralRe: ViewState storing custom class Pin
ToddHileHoffer23-Apr-09 7:09
ToddHileHoffer23-Apr-09 7:09 
QuestionAutomated Emails and SMS Pin
yogesh_kumar_agarwal22-Apr-09 7:51
yogesh_kumar_agarwal22-Apr-09 7:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.