Program łączy się z bazą danych i zapisuje jej zawartość do pliku XML.
Aby wybrać pewne dane z tabelax muszę się z nią łączyć dwa razy.
SqlDataAdapter daAuthors
= new SqlDataAdapter("SELECT dane1 as 'KOD' from tabelax where numer = '0'", objConn);
SqlDataAdapter daAuthors2
= new SqlDataAdapter("SELECT dane2 from tabelax WHERE cos = '2033')", objConn);
można to jakoś uprościć?
string sConnectionString;
sConnectionString = "Data Source=serwer;Initial Catalog=test;Persist Security Info=True;User ID=uzytkownik; Password=;";
SqlConnection objConn
= new SqlConnection(sConnectionString);
objConn.Open();
SqlDataAdapter daAuthors
= new SqlDataAdapter("SELECT tabelax as 'KOD' from karty where numer = '0'", objConn);
SqlDataAdapter daAuthors2
= new SqlDataAdapter("SELECT tabelax WHERE cos = '2033')", objConn);
DataSet ds = new DataSet("Invoice");
daAuthors.Fill(ds, "InvoiceHeader");
daAuthors2.Fill(ds, "InvoiceHeader2");
dataGridView1.DataSource = ds;
ds.WriteXml(@"c:\test.xml");
dataGridView1.DataSource = ds;
objConn.Close();