Click here to Skip to main content
15,894,291 members
Home / Discussions / C#
   

C#

 
AnswerRe: windows service - not allowing shut down Pin
Dario Solera25-May-08 0:38
Dario Solera25-May-08 0:38 
QuestionIs it possible to place my C# form beneath the desktop icons? Pin
buypymoncdnx24-May-08 10:51
buypymoncdnx24-May-08 10:51 
AnswerRe: Is it possible to place my C# form beneath the desktop icons? Pin
Ed.Poore24-May-08 12:01
Ed.Poore24-May-08 12:01 
QuestionProblem in Reports Pin
Shuaib wasif khan24-May-08 10:26
Shuaib wasif khan24-May-08 10:26 
QuestionHow recognize the keyboard pressed button ? ( code attached ) Pin
Yanshof24-May-08 8:11
Yanshof24-May-08 8:11 
QuestionHow to AutoScrolling my richTextBox ? Pin
hdv21224-May-08 7:36
hdv21224-May-08 7:36 
AnswerRe: How to AutoScrolling my richTextBox ? Pin
Giorgi Dalakishvili24-May-08 8:35
mentorGiorgi Dalakishvili24-May-08 8:35 
QuestionPlease tell me how to view structure of .mdb file? [modified] Pin
cuongmits24-May-08 7:15
cuongmits24-May-08 7:15 
I have an exercise:
Use C# to view structure of .mdb file (MS Access file). All the names of tables from file will be viewed in one listbox, all column-names (fields) of table, which is choiced from that list box, will be view in another listbox. And one checkbox will show if the field that we select from 2nd listbox is key or not.

This is the first time I work with mdb file in C#, please masters, help me to resolve this exercise.

This is code that I've tried to do:

<br />
        string DBPath;<br />
        OleDbConnection DBConnection;<br />
        DataTable SchemaTable;<br />
        DataColumn SchemaColumn;<br />
        DataSet dbSet = new DataSet();<br />
<br />
(blah blah..)<br />
<br />
                DBPath="Provider=Microsoft.Jet.OLEDB.4.0; Data Source = " + openFileDialog1.FileName.ToString();<br />
                DBConnection = new OleDbConnection(DBPath);<br />
                DBConnection.Open();<br />
                //Retrieve schema information about tables.<br />
                //Because tables include tables, views, and other objects,<br />
                //restrict to just TABLE in the Object array of restriction.<br />
                SchemaTable = DBConnection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new Object[] { null, null, null, "TABLE" });<br />
                lstbox_tables.Items.Clear();<br />
                //List the table name from each row in the schema table.<br />
                for (int i = 0; i < SchemaTable.Rows.Count; i++)//tong so bang<br />
                {                   lstbox_tables.Items.Add(SchemaTable.Rows[i].ItemArray[2].ToString());//itemarray[2] de hien thi ten bang<br />
                }<br />
........something need to be added here from you..My code that was not correct is here:<br />
<br />
            int table_index = lstbox_tables.SelectedIndex; //index of table<br />
<br />
            //int number_of_columns = SchemaTable.Rows[table_index].Table.Rows.Count;//12 number of column in table [index]<br />
            //int number_of_columns = SchemaTable.Rows[table_index].Table.Columns.Count;//9<br />
            //int number_of_columns = SchemaTable.Rows[table_index].Table.DataSet.Tables.Count;<br />
            <br />
            //int number_of_columns = SchemaTable.Rows[table_index].Table.fi<br />
<br />
<br />
            //MessageBox.Show(SchemaTable.Rows[table_index].Table.Rows[2].ItemArray[2].ToString());<br />
            MessageBox.Show(number_of_columns.ToString());<br />
            lstbox_fields.Items.Clear();<br />
            for (int i = 0; i < number_of_columns; i++)<br />
            {<br />
                //lstbox_fields.Items.Add(SchemaTable.Rows[table_index].Table.Rows[number_of_columns].ItemArray[2].ToString());<br />
            }<br />
<br />
<br />
<br />
//----<br />
<br />
<br />
<br />


modified on Saturday, May 24, 2008 1:41 PM

QuestionHow to launch your application minimized in sidebar not in taskbar by pressing a certain key Pin
Sakshi Smriti24-May-08 6:52
Sakshi Smriti24-May-08 6:52 
AnswerRe: How to launch your application minimized in sidebar not in taskbar by pressing a certain key Pin
Ed.Poore24-May-08 9:21
Ed.Poore24-May-08 9:21 
AnswerRe: How to launch your application minimized in sidebar not in taskbar by pressing a certain key Pin
DaveyM6924-May-08 10:05
professionalDaveyM6924-May-08 10:05 
QuestionApplying Jena in .NET framework Pin
Asemeh24-May-08 5:38
Asemeh24-May-08 5:38 
QuestionEditable ComboBox in DataGridView Pin
Abdul Rahman Hamidy24-May-08 2:53
Abdul Rahman Hamidy24-May-08 2:53 
QuestionGet SHA-1 Hash of a File without opening it? Pin
Ian Uy24-May-08 2:20
Ian Uy24-May-08 2:20 
AnswerRe: Get SHA-1 Hash of a File without opening it? Pin
Ravi Bhavnani24-May-08 3:01
professionalRavi Bhavnani24-May-08 3:01 
AnswerRe: Get SHA-1 Hash of a File without opening it? Pin
User 665824-May-08 4:03
User 665824-May-08 4:03 
QuestionGet Files list from Remote server in a Directory Pin
Kumaran21cen24-May-08 2:09
Kumaran21cen24-May-08 2:09 
AnswerRe: Get Files list from Remote server in a Directory Pin
Ravi Bhavnani24-May-08 3:04
professionalRavi Bhavnani24-May-08 3:04 
AnswerRe: Get Files list from Remote server in a Directory Pin
Bert delaVega25-May-08 12:47
Bert delaVega25-May-08 12:47 
QuestionHow to get the linebreak between two lines Pin
Exelioindia24-May-08 1:26
Exelioindia24-May-08 1:26 
AnswerRe: How to get the linebreak between two lines Pin
Zoltan Balazs24-May-08 2:04
Zoltan Balazs24-May-08 2:04 
GeneralRe: How to get the linebreak between two lines Pin
PIEBALDconsult24-May-08 3:34
mvePIEBALDconsult24-May-08 3:34 
GeneralRe: How to get the linebreak between two lines Pin
Zoltan Balazs24-May-08 5:16
Zoltan Balazs24-May-08 5:16 
GeneralRe: How to get the linebreak between two lines Pin
Exelioindia24-May-08 9:01
Exelioindia24-May-08 9:01 
QuestionFileSystemWatcher class Pin
Bambor24-May-08 1:03
Bambor24-May-08 1:03 

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.