Click here to Skip to main content
16,018,904 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I want to fetch my database values into controls.........

Here i retrieved the names from database to combobox but i cant display the respected details of name(like their ID,name,address) into the textbox..........

I got the error of "It does not have the definition of dviewmanager... "
System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection();
            conn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;" +
                @"Data Source=C:\Documents and Settings\User1\My Documents\\test.mdb";
            System.Data.OleDb.OleDbCommand cmd = new System.Data.OleDb.OleDbCommand();
            OleDbDataAdapter da = new OleDbDataAdapter("select ID,Name from tab", conn);
            DataSet ds=new DataSet();
            da.TableMappings.Add("Table", "tab");
            da.Fill(ds);
            DataTable myDataTable = ds.Tables[0];
            comboBox1.DataSource = myDataTable;
            comboBox1.DisplayMember = "Name";
           // comboBox1.ValueMember = "Name";
            this.dviewmanager = ds.DefaultViewManager;
            this.textBox1.DataBindings.Add("Text", this.dviewmanager,
                                                   "tab.ID");
            this.textBox2.DataBindings.Add("Text", this.dviewmanager,
                                                   "tab.Name");
            this.textBox3.DataBindings.Add("Text", this.dviewmanager,
                                                   "tab.Pword");

Pls help me to clear this error.
Posted
Updated 27-Jun-11 1:44am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900