I'm having difficulty creating a month-count select query in SQL.
Basically, I have a list of entries, all of which have a date associated with them. What I want the end result to be, is a list containing 12 rows (one for each month), and each row would contain the month number (1 for January, 2 for February, etc), and a count of how many entries had that month set as it's date. Something like this:
Month - Count
1 - 12
2 - 0
3 - 7
4 - 0
5 - 9
6 - 0
I can get an result containing months that have a count of higher than 0, but if the month contains no entries, the row isn't created. I get this result just by doing
SELECT Month(goalDate) as monthNumber, count(*) as monthCount
FROM goalsList
WHERE Year(goalDate) = 2012
GROUP BY Month(goalDate)
ORDER BY monthNumber
Thanks in advance for the help!
I have the following query....
UPDATE vehicle_catalog SET parent_id = 0 WHERE parent_id = SUBSTR(id, 0, 5)
I need to set all parent_ids to 0 where the first 5 characters of id is the same as the parent_id. This is effecting 0 rows when I'm looking at the data and it should be effecting over 10,000.
Any ideas on why this wouldn't be effecting all rows?
So apparently i've stumbled upon a coding error when trying to select the time from my database.
SELECT * FROM `videos` WHERE `added_time` > AddTime( CurTime(), '14400 hour' )
is the code, i'm trying to select all the videos posted 10 days (14400 hours) ago using the "added_time" format, because it worked for my previous coding but in this one it work work.
Shown below is a link to the image showing how my database structure for videos are shown.
http://i.imm.io/NURT.png
Edit: Previously i had this problem for retrieving and deleting bulletins posted 10 days ago, and this code worked, however this code apparently won't work when trying to retrieve the videos :/ I don't know why, they're using the same format.
See: http://i.imm.io/NUSW.png
Hi
Is there are a better way than this one to print 2d table?
std::cout
<< std::setw(25) << left << "FF.name"
<< std::setw(25) << left << "BB.name"
<< std::setw(12) << left << "sw.cycles"
<< std::setw(12) << left << "hw.cycles" << "\n"
<< std::setw(25) << left << "------"
<< std::setw(25) << left << "------"
<< std::setw(12) << left << "---------"
<< std::setw(12) << left << "---------" << "\n";
We are looking for Web Designers & Developers. Urgent Opening.
Profile:-
a) Have exp. in Designing websites in wordpress
b) Have Creativity in work
c) Send us your work – [email protected]
d) Min Exp. required: 2 + years
e) Can Integrate the Facebook, Twitter & other social networking websites.
To review our profile – please check – www.dicorporation.com & www.ismoip.com
I have this SQL by a programmer:
$sql = "
INSERT INTO
`{$database}`.`table`
(
`my_id`,
`xType`,
`subType`,
`recordID`,
`textarea`
)
VALUES
(
{$my_id},
?xType,
?subType,
{$recordID},
?areaText
) ";
My question is why is he using ? before values? How do I see what values are coming in? I did echo and it shows ?xType as ?xType. No values. What does ? stand for in SQL?
Hi, I am pretty new to web development and I want to create a search system on my webpage, but I dont have any idea how to?
This search system must be able to search everything that is displayed on the webpage.
Please help me.
Hello,
I am trying to increment a INT column by 1 if a certain field is not null on an update request, currently I have this update too columns,
public function updateCronDetails($transaction_reference, $flag, $log) {
$data = array (
'flag' => $flag,
'log' => "$log"
);
$this->db->where('transaction_reference', $transaction_reference);
$this->db->update('sy_cron', $data);
}
What I need to know is how I can check if the value being sent to the log field is NULL and if it is how could I increment a column called count by 1?
Here is my code
<?php require_once 'connect.php';
$sql = "SELECT * FROM `db-pages`";
$result = $mysqli->query($sql) or die($mysqli->error.__LINE__);
while ($row = $result->fetch_assoc()) {
echo($row['pagetitle'].' - To edit this page <a href="editpage.php?id='.$row['id'].'">click here</a><br>');
}
}
?>
I've added a couple more rows to the Database and it's returning them all, apart from id=1 in the DB. Any idea why?
select a.userid,(select firstName from user where userid=NOTUSED.userid) as z,
(select max(login_time) from userLoginTime AS b where userid = a.user_id
GROUP BY b.user_id ORDER BY b.user_id) as y
From(SELECT DISTINCT a.user_id FROM user AS a
LEFT OUTER JOIN (SELECT (userid) FROM userlogintime
where serialid=15400012)AS b ON user.user_id = b.user_id
where a.Serialid=15400012 AND b.userid IS NULL) NOTUSED,
Relation r, user a where r.childuserid = NOTUSED.userid
and guarduserid = a.userid
A problem I recently ran into was that when trying to update a field in my database using this code would not work. I traced it back to having a % sign in the text being updated ($note, then $note_escaped)... Inserting it with sprintf worked fine though.
Should I not be using sprintf for updates, or should it be formed differently?
I did some searching but couldn't come up with anything.
$id = mysql_real_escape_string($id);
$note_escaped = mysql_real_escape_string($note);
$editedby = mysql_real_escape_string($author);
$editdate = mysql_real_escape_string($date);
//insert info from form into database
$query= sprintf("UPDATE notes_$suffix SET note='$note_escaped', editedby='$editedby', editdate='$editdate' WHERE id='$id' LIMIT 1");
Thanks much!
I have found a field in DSDT table where I want to modify from here
http://www.ztex.de/misc/c2ctl.e.html
Generally, I want to modify the _PSS field about the processor so that I can have more frequency levels available in the CPUfreq driver interface.
I try to use this command to dissemble the DSDT table from my Desktop(Linux2.6.29,Intel CORE 2):
cat /proc/acpi/dsdt > dsdt.aml
iasl -d dsdt.aml
Then I have a file dsdt.dsl as following(very long, so I just show the beginning of the file):
/*
* Intel ACPI Component Architecture
* AML Disassembler version 20090123
*
* Disassembly of dsdt.aml, Mon May 6 20:41:40 2013
*
*
* Original Table Header:
* Signature "DSDT"
* Length 0x00003794 (14228)
* Revision 0x01 **** ACPI 1.0, no 64-bit math support
* Checksum 0x46
* OEM ID "DELL"
* OEM Table ID "dt_ex"
* OEM Revision 0x00001000 (4096)
* Compiler ID "INTL"
* Compiler Version 0x20050624 (537200164)
*/
DefinitionBlock ("dsdt.aml", "DSDT", 1, "DELL", "dt_ex", 0x00001000)
{
Method (DBIN, 0, NotSerialized)
{
Noop
}
Scope (\)
{
Device (_SB.VBTN)
...................
But I can not find the _PSS field as shown in the website I have given above. I do not know why? I am sure the current cpufreq driver shows 4 frequency levels available. So at least there should be something in the table showing this..right?
Has anybody here played with the DSDT table before? Thanks,
MySQL is eating up about 80% of my CPU for no reason as far as I can see. Right now this server is rarely used, more of a test site I set up that will eventually be a used for production once I fix small problems like this. I run 3 instances of MySQL but it seems that my first instance is taking up all the CPU. When I turn off the first instance and leave the other two on everything runs fine.
Any suggestions?
I tried Show Processlist and no statements are being run besides "Sleep" and the query "Show Processlist" (obviously) at the time it's using up all this CPU.
my.cnf is basic. I did not optimize or change any MySQL settings. Do you think this would cause such strange behavior?
The machine is running Linux Centos 5.7 64 bit and MySQL 5.0.95.
Thanks
I am having a problem setting the background of UITableView to a UIImageView (see below for why I am doing this), once the view is set, it works fine, and scrolls with the UITableView, but it hides the elements of the Table View.
I need to have a UIImageView as the background for a UITableView. I know this has been answered before, but the answers are to use:
[UIColor colorWithPatternImage:[UIImage imageNamed:@"myImage.png"]];
Or something like (which I need to use):
UIImageView *background = [MainWindow generateBackgroundWithFrame:tableView.bounds];
[tableView addSubview:background];
[tableView sendSubviewToBack:background];
The reason I need to use the latter is because of my generateBackgroundWithFrame method, which takes a large image, and draws a border around that image to the dimensions specified, and clips the remainder of the image:
+ (UIImageView *) generateBackgroundWithFrame: (CGRect)frame {
UIImageView *background = [[[UIImageView alloc] initWithFrame:frame] autorelease];
background.image = [UIImage imageNamed:@"globalBackground.png"];
[background.layer setMasksToBounds:YES];
[background.layer setCornerRadius:10.0];
[background.layer setBorderColor:[[UIColor grayColor] CGColor]];
[background.layer setBorderWidth:3.0];
return background;
}
Please note: I understand that this might poorly effect performance, but I don't have the resources to go through and make those images for each potential screen in the app. Please do not answer this question with a mindless "you shouldn't do this" response. I am aware that it is possibly the wrong thing to do.
How do I show my UITableView control elements? Is there something that I am doing wrong in my delegate? Here is a simplified version:
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell =
[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc]
initWithFrame:CGRectMake(20, 20, 261, 45)
reuseIdentifier:CellIdentifier] autorelease];
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
UIImage *rowBackground;
NSString *imageName = @"standAloneTVButton.png";
rowBackground = [UIImage imageNamed:imageName];
UITextView *textView =
[[UITextView alloc] initWithFrame:CGRectMake(0, 5, 300, 200)];
textView.backgroundColor = [UIColor clearColor];
textView.textColor = [UIColor blackColor];
textView.font = [UIFont fontWithName:@"Helvetica" size:18.0f];
Purchase *purchase =
[[PurchaseModel productsPurchased] objectAtIndex:indexPath.row];
textView.text = [purchase Title];
selectedTextView.text = textView.text;
UIImageView *normalBackground =
[[[UIImageView alloc] init] autorelease];
normalBackground.image = rowBackground;
[normalBackground insertSubview:textView atIndex:0];
cell.backgroundView = normalBackground;
[textView release];
}
return cell;
}
I am attempting to print some values i have stored into a LLL into a readable table.
The data i have stored is the following :
DEBBIE STARR F 3 W 1000.00
JOAN JACOBUS F 9 W 925.00
DAVID RENN M 3 H 4.75
ALBERT CAHANA M 3 H 18.75
DOUGLAS SHEER M 5 W 250.00
SHARI BUCHMAN F 9 W 325.00
SARA JONES F 1 H 7.50
RICKY MOFSEN M 6 H 12.50
JEAN BRENNAN F 6 H 5.40
JAMIE MICHAELS F 8 W 150.00
i have stored each firstname, lastname, gender, tenure, payrate, and salary into their own List. And would like to be able to print them out in the same format that they are viewed on the text file i read them in from. i have messed around with a few methods that allow me to traverse and print the Lists, but i end up with ugly output. . .
here is my code for the storage of the text file and the format i would like to print out:
public class Payroll
{
private LineWriter lw;
private ObjectList output;
ListNode input;
private ObjectList firstname, lastname, gender, tenure, rate, salary;
public Payroll(LineWriter lw)
{
this.lw = lw;
this.firstname = new ObjectList();
this.lastname = new ObjectList();
this.gender = new ObjectList();
this.tenure = new ObjectList();
this.rate = new ObjectList();
this.salary = new ObjectList();
this.output = new ObjectList();
this.input = new ListNode();
}
public void readfile()
{
File file = new File("payfile.txt");
try{
Scanner scanner = new Scanner(file);
while(scanner.hasNextLine())
{
String line = scanner.nextLine();
Scanner lineScanner = new Scanner(line);
lineScanner.useDelimiter("\\s+");
while(lineScanner.hasNext())
{
firstname.insert1(lineScanner.next());
lastname.insert1(lineScanner.next());
gender.insert1(lineScanner.next());
tenure.insert1(lineScanner.next());
rate.insert1(lineScanner.next());
salary.insert1(lineScanner.next());
}
}
}catch(FileNotFoundException e)
{e.printStackTrace();}
}
public void printer(LineWriter lw)
{
String msg = " FirstName " + " LastName " + " Gender " + " Tenure " +
" Pay Rate " + " Salary ";
output.insert1(msg);
System.out.println(output.getFirst());
System.out.println(" " + firstname.getFirst() + " " + lastname.getFirst() + "\t" + gender.getFirst() +
"\t" + tenure.getFirst() + "\t" + rate.getFirst() + "\t" + salary.getFirst());
}
}
I have a table layout (code below), but I have am having a bit of a problem with the width of the cells. The picture below shows the problem. There should be a white border on the right hand side of the screen. I also want the text "Auditorium" not to wrap onto a new line (I would prefer that "13th -" get put onto the new line instead, I don't want to put \n in there because then it would mean it goes onto a new line at that point on bigger screens/landscape view).
How can I fix those two problems?
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#013567" >
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:shrinkColumns="*"
android:stretchColumns="*" >
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/textlines"
android:gravity="center"
android:text="@string/meeting_5"
android:textColor="#fff" >
</TextView>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/textlines"
android:gravity="center"
android:text="@string/meeting_5_date"
android:textColor="#fff" >
</TextView>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/textlines"
android:gravity="center"
android:text="@string/meeting_5_location"
android:textColor="#fff" >
</TextView>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/textlines"
android:gravity="center"
android:text="@string/AGM"
android:textColor="#fff" >
</TextView>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/textlines"
android:gravity="center"
android:text="@string/AGM_date"
android:textColor="#fff" >
</TextView>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/textlines"
android:gravity="center"
android:text="@string/AGM_location"
android:textColor="#fff" >
</TextView>
</TableRow>
</TableLayout>
Greetings,
A site I designed was compromised today, working on damage control at the moment. Two user accounts, including the primary administrator, were accessed without authorization. Please take a look at the log-in script that was in use, any insight on security holes would be appreciated. I am not sure if this was an SQL injection or possibly breach on a computer that had been used to access this area in the past.
Thanks
<?php
//Start session
session_start();
//Include DB config
require_once('config.php');
//Error message array
$errmsg_arr = array();
$errflag = false;
//Connect to mysql server
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if(!$link) {
die('Failed to connect to server: ' . mysql_error());
}
//Select database
$db = mysql_select_db(DB_DATABASE);
if(!$db) {
die("Unable to select database");
}
//Function to sanitize values received from the form. Prevents SQL injection
function clean($str) {
$str = @trim($str);
if(get_magic_quotes_gpc()) {
$str = stripslashes($str);
}
return mysql_real_escape_string($str);
}
//Sanitize the POST values
$login = clean($_POST['login']);
$password = clean($_POST['password']);
//Input Validations
if($login == '') {
$errmsg_arr[] = 'Login ID missing';
$errflag = true;
}
if($password == '') {
$errmsg_arr[] = 'Password missing';
$errflag = true;
}
//If there are input validations, redirect back to the login form
if($errflag) {
$_SESSION['ERRMSG_ARR'] = $errmsg_arr;
session_write_close();
header("location: http://tapp-essexvfd.org/admin/index.php");
exit();
}
//Create query
$qry="SELECT * FROM user_control WHERE username='$login' AND password='".md5($_POST['password'])."'";
$result=mysql_query($qry);
//Check whether the query was successful or not
if($result) {
if(mysql_num_rows($result) == 1) {
//Login Successful
session_regenerate_id();
//Collect details about user and assign session details
$member = mysql_fetch_assoc($result);
$_SESSION['SESS_MEMBER_ID'] = $member['user_id'];
$_SESSION['SESS_USERNAME'] = $member['username'];
$_SESSION['SESS_FIRST_NAME'] = $member['name_f'];
$_SESSION['SESS_LAST_NAME'] = $member['name_l'];
$_SESSION['SESS_STATUS'] = $member['status'];
$_SESSION['SESS_LEVEL'] = $member['level'];
//Get Last Login
$_SESSION['SESS_LAST_LOGIN'] = $member['lastLogin'];
//Set Last Login info
$qry = "UPDATE user_control SET lastLogin = DATE_ADD(NOW(), INTERVAL 1 HOUR) WHERE user_id = $member[user_id]";
$login = mysql_query($qry) or die(mysql_error());
session_write_close();
if ($member['level'] != "3" || $member['status'] == "Suspended") {
header("location: http://members.tapp-essexvfd.org"); //CHANGE!!!
} else {
header("location: http://tapp-essexvfd.org/admin/admin_main.php");
}
exit();
}else {
//Login failed
header("location: http://tapp-essexvfd.org/admin/index.php");
exit();
}
}else {
die("Query failed");
}
?>
I have a table of data with survey results, and I want to do certain calculations on this data. The datastructure is somewhat like this:
____________________________________________________________________________________
| group |individual | key | key | key |
| | |subkey|subkey|subkey|subkey|subkey|subkey|subkey|subkey|subkey|
| | |q|q|q |q |q |q|q|q |q|q|q |q |q |q|q|q |q|q|q |q |q |q|q|q |
|-------|-----------|-|-|--|--|---|-|-|--|-|-|--|--|---|-|-|--|-|-|--|--|---|-|-|--|
| 1 | 0001 |1|7|5 |1 |3 |1|4|1 |1|7|5 |1 |3 |1|4|1 |1|7|5 |1 |3 |1|4|1 |
| 1 | 0002 |1|7|5 |1 |3 |1|4|1 |1|7|5 |1 |3 |1|4|1 |1|7|5 |1 |3 |1|4|1 |
| 1 | 0003 |1|7|5 |1 |3 |1|4|1 |1|7|5 |1 |3 |1|4|1 |1|7|5 |1 |3 |1|4|1 |
| 2 | 0004 |1|7|5 |1 |3 |1|4|1 |1|7|5 |1 |3 |1|4|1 |1|7|5 |1 |3 |1|4|1 |
| 2 | 0005 |1|7|5 |1 |3 |1|4|1 |1|7|5 |1 |3 |1|4|1 |1|7|5 |1 |3 |1|4|1 |
| 3 | 0006 |1|7|5 |1 |3 |1|4|1 |1|7|5 |1 |3 |1|4|1 |1|7|5 |1 |3 |1|4|1 |
| 4 | 0007 |1|7|5 |1 |3 |1|4|1 |1|7|5 |1 |3 |1|4|1 |1|7|5 |1 |3 |1|4|1 |
------------------------------------------------------------------------------------
Excuse my poor ascii skills...
So, every individual belongs to a group, and has answered some questions. These questions are always grouped in keys and subkeys.
Is there any simple method to calculate averages, deviations and similar based on the groupings.
Something like
public float getAverage(int key, int individual);
float avg = getAverage(5,7);
I think what I'm asking is what would be the best way to structure the data in C# to make it as easy as possible to work with?
I have started making classes for every entity, but I got confused somewhere and something stopped working. So before I continue along this path, I was wondering if there are any other, better, ways of doing this?
(Every individual can also have describing variables, like agegroup and such, but that's not important for the base functionality.)
Our current solution does all calculations inline in the queries when requesting the data from the database. This works, but it's slow and the number of queries equals questions * individuals + keys * individuals, which could be alot if individual queries.
Any suggestions?
I am adding a new address and I know the structure as AddressID = PK and all other entities are non nullable. Now on insert of a new row the addrID Pk is autogened and I am wondering if I would have to get that to create a new row in the referencing table EmployeeAddress or does that automatically get generated also.
also I want to be able to repopulate the dropdownlist that lists the current employee's addresses with the newly created address.
static uint _curEmpID;
protected void btnAdd_Click(object sender, EventArgs e)
{
if (txtZip.Text != "" && txtAdd1.Text != "" && txtCity.Text != "")
{
TestDataClassDataContext dc = new TestDataClassDataContext();
Address addr = new Address()
{
AddressLine1 = txtAdd1.Text,
AddressLine2 = txtAdd2.Text,
City = txtCity.Text,
PostalCode = txtZip.Text,
StateProvinceID = Convert.ToInt32(ddlState.SelectedValue)
};
dc.Addresses.InsertOnSubmit(addr);
lblSuccess.Visible = true;
lblErrMsg.Visible = false;
dc.SubmitChanges();
//
// TODO: insert new row in EmployeeAddress to reference CurEmp to newly created address
//
SetAddrList();
}
else
{
lblErrMsg.Text = "Invalid Input";
lblErrMsg.Visible = true;
}
}
protected void ddlAddList_SelectedIndexChanged(object sender, EventArgs e)
{
lblErrMsg.Visible = false;
lblSuccess.Visible = false;
TestDataClassDataContext dc = new TestDataClassDataContext();
dc.ObjectTrackingEnabled = false;
if (ddlAddList.SelectedValue != "-1")
{
var addr = (from a in dc.Addresses
where a.AddressID == Convert.ToInt32(ddlAddList.SelectedValue)
select a).FirstOrDefault();
txtAdd1.Text = addr.AddressLine1;
txtAdd2.Text = addr.AddressLine2;
txtCity.Text = addr.City;
txtZip.Text = addr.PostalCode;
ddlState.SelectedValue = addr.StateProvinceID.ToString();
btnSubmit.Visible = true;
btnAdd.Visible = false;
}
else
{
txtAdd1.Text = "";
txtAdd2.Text = "";
txtCity.Text = "";
txtZip.Text = "";
btnAdd.Visible = true;
btnSubmit.Visible = false;
}
}
protected void SetAddrList()
{
TestDataClassDataContext dc = new TestDataClassDataContext();
dc.ObjectTrackingEnabled = false;
var addList = from addr in dc.Addresses
from eaddr in dc.EmployeeAddresses
where eaddr.EmployeeID == _curEmpID && addr.AddressID == eaddr.AddressID
select new
{
AddValue = addr.AddressID,
AddText = addr.AddressID,
};
ddlAddList.DataSource = addList;
ddlAddList.DataValueField = "AddValue";
ddlAddList.DataTextField = "AddText";
ddlAddList.DataBind();
ddlAddList.Items.Add(new ListItem("<Add Address>", "-1"));
}
OK I am hoping that I did not include too much code. I would really appreciate any other comments about I could otherwise improve this code in any other ways also.
Consider the folowing where I am reading the data table values and writing to a text file
using (StreamWriter sw = new StreamWriter(@"C:\testwrite.txt",true))
{
DataPreparation().AsEnumerable().ToList().ForEach(i =>
{
string col1 = i[0].ToString();
string col2 = i[1].ToString();
string col3 = i[2].ToString();
string col4 = i[3].ToString();
sw.WriteLine(
col1 + "\t"
+ col2 + "\t" +
col3 + "\t" +
col4 + Environment.NewLine
);
});
}
The data preparation function is as under
private static DataTable DataPreparation()
{
DataTable dt = new DataTable();
dt.Columns.Add("Col1", typeof(string));
dt.Columns.Add("Col2", typeof(int));
dt.Columns.Add("Col3", typeof(DateTime));
dt.Columns.Add("Col4", typeof(bool));
for (int i = 0; i < 10; i++)
{
dt.Rows.Add("String" + i.ToString(), i, DateTime.Now.Date, (i % 2 == 0) ? true : false);
}
return dt;
}
It is working fine.
Now in the above described program, it is known to me the Number of columns and the column headers.
How to achieve the same in case when the column headers and number of columns are not known at compile time using the lambda expression?
I have already done that which is as under
public static void WriteToTxt(string directory, string FileName, DataTable outData, string delimiter)
{
FileStream fs = null;
StreamWriter streamWriter = null;
using (fs = new FileStream(directory + "\\" + FileName + ".txt", FileMode.Append,
FileAccess.Write))
{
try
{
streamWriter = new StreamWriter(fs);
streamWriter.BaseStream.Seek(0, SeekOrigin.End);
streamWriter.WriteLine();
DataTableReader datatableReader = outData.CreateDataReader();
for (int header = 0; header < datatableReader.FieldCount; header++)
{
streamWriter.Write(outData.Columns[header].ToString() + delimiter);
}
streamWriter.WriteLine();
int row = 0;
while (datatableReader.Read())
{
for (int field = 0; field < datatableReader.FieldCount; field++)
{
streamWriter.Write(outData.Rows[row][field].ToString() + delimiter);
}
streamWriter.WriteLine();
row++;
}
}
catch (Exception ex)
{
throw ex;
}
}
}
I am using C#3.0 and framework 3.5
Thanks in advance