Click here to Skip to main content
15,877,384 members
Home / Discussions / C#
   

C#

 
GeneralRe: Passing Label's Name within a Class outside of the Form Pin
Luc Pattyn15-Oct-09 10:55
sitebuilderLuc Pattyn15-Oct-09 10:55 
AnswerRe: Passing Label's Name within a Class outside of the Form Pin
Ravi Bhavnani15-Oct-09 5:37
professionalRavi Bhavnani15-Oct-09 5:37 
QuestionParse SQL and replace column name with another name Pin
AhmedMasum15-Oct-09 4:27
AhmedMasum15-Oct-09 4:27 
AnswerRe: Parse SQL and replace column name with another name Pin
PIEBALDconsult15-Oct-09 4:56
mvePIEBALDconsult15-Oct-09 4:56 
GeneralRe: Parse SQL and replace column name with another name Pin
AhmedMasum17-Oct-09 2:37
AhmedMasum17-Oct-09 2:37 
QuestionChange color of RibbonControl Pin
yogesh_softworld12315-Oct-09 3:47
yogesh_softworld12315-Oct-09 3:47 
AnswerRe: Change color of RibbonControl Pin
Henry Minute15-Oct-09 4:56
Henry Minute15-Oct-09 4:56 
QuestionLearning ForEach... Pin
JollyMansArt15-Oct-09 3:21
JollyMansArt15-Oct-09 3:21 
I would like to learn how to do for each. I have been researching. I also know this should be one of those no brainier questions but I am still piecing together how to make foreach for for me.

I know how to count my tables and fields then place the information in. But what I would like is to learn how to use the foreach command. to say something like.

Foreach (table in Database)
{
Foreach (column in table)
{
}
}
instead of counting the tables and columns and their names.
This will allow me to recreate a database from an existing one.

Any websites or information you can provide to point me in the right direction would be appreciated.



Just for reference purposes...
string sConnectString = "Driver={QODBC Driver for QuickBooks};DFQ=C:\\Quickbooks\\sample_company_file.qbw;OpenMode=M;OLE DB Services=-2;";
            string sSQL = "SELECT Name FROM Employee";
           
            OdbcConnection cn;
            OdbcCommand cmd;
            
            //string MyString;
            //MyString="Select * from Customers";
            //cn = new OdbcConnection("Driver={SQL Server};Server=mySQLServer;UID=sa;PWD=myPassword;Database=Northwind;");
            
            cn = new OdbcConnection(sConnectString);
            cmd =new OdbcCommand(sSQL,cn);
            
            
            //cn.Open();
            //MessageBox.Show("Connected");
            //cn.Close();
            
            try               
               {
                  cn.Open();
                MessageBox.Show("open");
                //odbcconnection1.GetSchema("tables")
                //odbcconnection1.GetSchema("columns")
                //http://www.daniweb.com/forums/thread194354.html
                OdbcDataReader dr = cmd.ExecuteReader();

                dr.GetSchemaTable().
                MessageBox.Show(dr.GetSchemaTable().TableName);





               }
            catch (OdbcException ex)
               {
                  MessageBox.Show(ex.Message);//<BR/>   There should be no <BR/>
               }
            finally
               {
                   cn.Close();
               }

AnswerRe: Learning ForEach... Pin
VanityClaw15-Oct-09 3:47
VanityClaw15-Oct-09 3:47 
GeneralRe: Learning ForEach... Pin
JollyMansArt15-Oct-09 3:53
JollyMansArt15-Oct-09 3:53 
QuestionDual running application using same database Pin
dptalt15-Oct-09 2:38
dptalt15-Oct-09 2:38 
AnswerRe: Dual running application using same database Pin
J4amieC15-Oct-09 2:44
J4amieC15-Oct-09 2:44 
AnswerRe: Dual running application using same database Pin
Not Active15-Oct-09 3:50
mentorNot Active15-Oct-09 3:50 
Questionrandom rename for files Pin
Jassim Rahma15-Oct-09 2:37
Jassim Rahma15-Oct-09 2:37 
AnswerRe: random rename for files Pin
J4amieC15-Oct-09 2:42
J4amieC15-Oct-09 2:42 
AnswerRe: random rename for files Pin
Manas Bhardwaj15-Oct-09 2:47
professionalManas Bhardwaj15-Oct-09 2:47 
GeneralRe: random rename for files Pin
Richard MacCutchan15-Oct-09 4:57
mveRichard MacCutchan15-Oct-09 4:57 
AnswerRe: random rename for files Pin
Luc Pattyn15-Oct-09 3:32
sitebuilderLuc Pattyn15-Oct-09 3:32 
Questionpdf to tiff conversion Pin
billcodes15-Oct-09 1:47
billcodes15-Oct-09 1:47 
AnswerRe: pdf to tiff conversion Pin
Pete O'Hanlon15-Oct-09 2:01
mvePete O'Hanlon15-Oct-09 2:01 
GeneralRe: pdf to tiff conversion Pin
Richard MacCutchan15-Oct-09 2:11
mveRichard MacCutchan15-Oct-09 2:11 
GeneralRe: pdf to tiff conversion Pin
Dave Kreskowiak15-Oct-09 2:28
mveDave Kreskowiak15-Oct-09 2:28 
GeneralRe: pdf to tiff conversion Pin
Pete O'Hanlon15-Oct-09 2:55
mvePete O'Hanlon15-Oct-09 2:55 
QuestionGird data handling via Linq Pin
saboor awan15-Oct-09 0:45
saboor awan15-Oct-09 0:45 
AnswerRe: Gird data handling via Linq Pin
Mirko198015-Oct-09 3:51
Mirko198015-Oct-09 3: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.