rdrunner400
Programmer
Hi all,
I have a SQL Server Table called Sample_Table which contains 70,000 records which are separated in 100 different areas by a field called District
What i have been trying to do is to extract into a separate table called Sample_Data_Table this i have to work as below one of each of the districts.
SqlDataAdapter da = new SqlDataAdapter("SELECT Distinct District FROM Sample_Table ORDER by District", cs);
// Create the Data Table
DataTable Sample_Data_Table = new DataTable();
// Fill Data Table with Records
da.Fill(Sample_Data_Table);
What i then want to do is to somehow loop around this Sample_Data_Table and then to extract out into 100 different tables / files all of the records that match the relevant field called district.
foreach (DataRow row in Sample_Data_Table.Rows)
{
SqlDataAdapter OutPut_Table = new SqlDataAdapter("SELECT * FROM Sample_Table WHERE Sample_Table.DISTRICT = Sample_Data_Table.Rows", cs);
// Create the Data Table
DataTable Export_Table = new DataTable();
// Fill Data Table with Records
OutPut_Table.Fill(Export_Table);
// when i get to this stage i need to be able to copy the table to a fox pro free standing table
// any help with this command string would also be welcome as i have not done this before
}
Currently this is not quite working and i am at a loss as to how to get it to work
thank you in advance
rdrunner40
I have a SQL Server Table called Sample_Table which contains 70,000 records which are separated in 100 different areas by a field called District
What i have been trying to do is to extract into a separate table called Sample_Data_Table this i have to work as below one of each of the districts.
SqlDataAdapter da = new SqlDataAdapter("SELECT Distinct District FROM Sample_Table ORDER by District", cs);
// Create the Data Table
DataTable Sample_Data_Table = new DataTable();
// Fill Data Table with Records
da.Fill(Sample_Data_Table);
What i then want to do is to somehow loop around this Sample_Data_Table and then to extract out into 100 different tables / files all of the records that match the relevant field called district.
foreach (DataRow row in Sample_Data_Table.Rows)
{
SqlDataAdapter OutPut_Table = new SqlDataAdapter("SELECT * FROM Sample_Table WHERE Sample_Table.DISTRICT = Sample_Data_Table.Rows", cs);
// Create the Data Table
DataTable Export_Table = new DataTable();
// Fill Data Table with Records
OutPut_Table.Fill(Export_Table);
// when i get to this stage i need to be able to copy the table to a fox pro free standing table
// any help with this command string would also be welcome as i have not done this before
}
Currently this is not quite working and i am at a loss as to how to get it to work
thank you in advance
rdrunner40