Click here to Skip to main content
14,875,886 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hey Friends,

i have export method which running gr8ly now i have to export data into multiple separate files which based on the following query,

DataExport(string query,string filename) ////this is intial method////

DataExport("SELECT * FROM SaiRamH WHERE [WARD NAME]= 'GENERAL WARD (FEMALE)' AND [REGNO/ID]= 'SH1401/00457';", "GenF0457.csv");

But my problem arises here that i want to export data based on ward name nad regno/id , but there is huge data of patients and regno/id is not serial value to put it on loop, and it is not possible to fire qury for each patient and specify regno/id for each patient. i really dont know how to do it.

when i run above method i want to create a csv file with name consist of first three letters of ward name and last four digits of regno/id. and regno/id and wardname should be retrived from database as datasaved in table serialy. automatically catch both from table without specifying into query.

for example:

here is record in database
wardname,regno/id
generalfemale,SH400/0023
icu,SH408/0804

hey friends i found answer myself by the following method,

public void exportAll()//Function declares methods to export//
{
int i = 0;
for (int icount = 0; icount <= 15; icount++)
{

Object o = saiRamDataSet11.Tables["SaiRamH"].Rows[i]["WARD NAME"];
Object ob = saiRamDataSet11.Tables["SaiRamH"].Rows[i]["REGNO/ID"];

DataExport("select * from SaiRamH where [WARD NAME]='" + o + "'" +
"and [REGNO/ID] ='" + ob + "'", "count"+icount+".csv");
i++;
}
Posted
Updated 6-May-15 0:23am
v3

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900