Skip to main content

Posts

Showing posts from June, 2008

Filling DataSets with Multiple Tables

Filling a DataSet with multiple tables can be done by sending multiple requests to the database, or in a faster way: Multiple SELECT statements can be sent to the database server in a single request. The problem here is that the tables generated from the queries have automatic names Table and Table1. However, the generated table names can be mapped to names that should be used in the DataSet. SqlDataAdapter adapter = new SqlDataAdapter( "SELECT * FROM Customers; SELECT * FROM Orders", connection); adapter.TableMappings.Add("Table", "Customer"); adapter.TableMappings.Add("Table1", "Order"); adapter.Fill(ds);

Enabling Network Tracing

o send traces to a log file, add the following node to the <system.diagnostics> node of the appropriate configuration file (application or machine). You can change the name of the file (trace.log) to suit your needs. Copy Code <system.diagnostics> <trace autoflush="true" indentsize="4"> <listeners> <add name="file" type="System.Diagnostics.TextWriterTraceListener" initializeData="trace.log"/> </listeners> </trace> </system.diagnostics>