Click here to Skip to main content
16,004,969 members
Home / Discussions / C#
   

C#

 
Questionxml Document Pin
arkiboys12-Oct-09 13:22
arkiboys12-Oct-09 13:22 
AnswerRe: xml Document Pin
Luc Pattyn12-Oct-09 13:40
sitebuilderLuc Pattyn12-Oct-09 13:40 
GeneralRe: xml Document Pin
arkiboys12-Oct-09 13:52
arkiboys12-Oct-09 13:52 
GeneralRe: xml Document Pin
Luc Pattyn12-Oct-09 14:04
sitebuilderLuc Pattyn12-Oct-09 14:04 
GeneralRe: xml Document Pin
arkiboys12-Oct-09 14:07
arkiboys12-Oct-09 14:07 
GeneralRe: xml Document Pin
Not Active12-Oct-09 15:26
mentorNot Active12-Oct-09 15:26 
GeneralRe: xml Document Pin
arkiboys12-Oct-09 19:55
arkiboys12-Oct-09 19:55 
QuestionLearning foreach... Pin
JollyMansArt12-Oct-09 13:12
JollyMansArt12-Oct-09 13:12 
What I would like to do is instead of manually parsing for each table and row. I would like to learn how to do a foreach to dynamically find each table and each row in a database. Here is what I curently have, All I am asking is how to use the foreach command to do this.

1) How would you say:
foreach(table in database)

then how would you say
foreach(row in table)

New experimental project I am playing with. I will post back when I find something. Just thought I would ask.


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
Luc Pattyn12-Oct-09 13:37
sitebuilderLuc Pattyn12-Oct-09 13:37 
AnswerRe: Learning foreach... Pin
OriginalGriff12-Oct-09 22:20
mveOriginalGriff12-Oct-09 22:20 
QuestiondataGridView and dataView Pin
mahraja12-Oct-09 12:51
mahraja12-Oct-09 12:51 
Questionxml Pin
arkiboys12-Oct-09 11:25
arkiboys12-Oct-09 11:25 
AnswerRe: xml Pin
Henry Minute12-Oct-09 12:05
Henry Minute12-Oct-09 12:05 
AnswerRe: xml Pin
DaveyM6912-Oct-09 12:24
professionalDaveyM6912-Oct-09 12:24 
GeneralRe: xml Pin
arkiboys12-Oct-09 12:47
arkiboys12-Oct-09 12:47 
GeneralRe: xml Pin
Not Active12-Oct-09 12:53
mentorNot Active12-Oct-09 12:53 
GeneralRe: xml Pin
arkiboys12-Oct-09 12:55
arkiboys12-Oct-09 12:55 
GeneralRe: xml Pin
DaveyM6912-Oct-09 13:06
professionalDaveyM6912-Oct-09 13:06 
GeneralRe: xml Pin
Not Active12-Oct-09 13:42
mentorNot Active12-Oct-09 13:42 
GeneralRe: xml Pin
Henry Minute12-Oct-09 13:02
Henry Minute12-Oct-09 13:02 
GeneralRe: xml Pin
arkiboys12-Oct-09 13:25
arkiboys12-Oct-09 13:25 
GeneralRe: xml Pin
Henry Minute13-Oct-09 0:40
Henry Minute13-Oct-09 0:40 
GeneralRe: xml Pin
arkiboys13-Oct-09 11:54
arkiboys13-Oct-09 11:54 
GeneralRe: xml Pin
DaveyM6912-Oct-09 13:26
professionalDaveyM6912-Oct-09 13:26 
GeneralRe: xml Pin
Not Active12-Oct-09 13:40
mentorNot Active12-Oct-09 13:40 

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.