Click here to Skip to main content
15,906,626 members
Home / Discussions / C#
   

C#

 
GeneralRe: Gmail APi's Pin
Norbert Szenasi27-Dec-10 6:27
Norbert Szenasi27-Dec-10 6:27 
QuestionDExplore issue Pin
dwolver1-Feb-10 2:13
dwolver1-Feb-10 2:13 
AnswerRe: DExplore issue Pin
ricmil421-Feb-10 3:26
ricmil421-Feb-10 3:26 
QuestionNeed to Import table & query from one MS Access databas to another. Pin
honeyashu1-Feb-10 2:01
honeyashu1-Feb-10 2:01 
AnswerRe: Need to Import table & query from one MS Access databas to another. [modified] Pin
Dan Mos1-Feb-10 2:51
Dan Mos1-Feb-10 2:51 
AnswerRe: Need to Import table & query from one MS Access databas to another. Pin
Md. Marufuzzaman1-Feb-10 9:04
professionalMd. Marufuzzaman1-Feb-10 9:04 
QuestionTrapping arrow keys in form Pin
Kaikus1-Feb-10 0:27
Kaikus1-Feb-10 0:27 
AnswerRe: Trapping arrow keys in form Pin
#realJSOP1-Feb-10 0:47
professional#realJSOP1-Feb-10 0:47 
GeneralRe: Trapping arrow keys in form Pin
Kaikus1-Feb-10 1:00
Kaikus1-Feb-10 1:00 
QuestionCrystal Report Probelm (Subreport) Pin
Syed Shahid Hussain1-Feb-10 0:10
Syed Shahid Hussain1-Feb-10 0:10 
AnswerRe: Crystal Report Probelm (Subreport) Pin
Nagy Vilmos1-Feb-10 2:31
professionalNagy Vilmos1-Feb-10 2:31 
GeneralRe: Crystal Report Probelm (Subreport) Pin
Syed Shahid Hussain1-Feb-10 3:04
Syed Shahid Hussain1-Feb-10 3:04 
GeneralRe: Crystal Report Probelm (Subreport) Pin
Nagy Vilmos2-Feb-10 5:38
professionalNagy Vilmos2-Feb-10 5:38 
QuestionInvoke MouseClick in MouveMove methode Pin
shantz1-Feb-10 0:03
shantz1-Feb-10 0:03 
AnswerRe: Invoke MouseClick in MouveMove methode Pin
#realJSOP1-Feb-10 0:49
professional#realJSOP1-Feb-10 0:49 
AnswerRe: Invoke MouseClick in MouveMove methode Pin
Alex Manolescu1-Feb-10 0:50
Alex Manolescu1-Feb-10 0:50 
QuestionCatch events in my code when VS discovers that the file has been modified outside of the source editor Pin
lucienzhang31-Jan-10 22:09
lucienzhang31-Jan-10 22:09 
AnswerRe: Catch events in my code when VS discovers that the file has been modified outside of the source editor Pin
DaveyM6931-Jan-10 22:16
professionalDaveyM6931-Jan-10 22:16 
GeneralRe: Catch events in my code when VS discovers that the file has been modified outside of the source editor Pin
lucienzhang31-Jan-10 22:25
lucienzhang31-Jan-10 22:25 
AnswerRe: Catch events in my code when VS discovers that the file has been modified outside of the source editor Pin
monstale31-Jan-10 22:33
monstale31-Jan-10 22:33 
QuestionRDLC C# 2005 multiple datasets in one Table ReportItem Pin
HennieSmit31-Jan-10 22:00
HennieSmit31-Jan-10 22:00 
QuestionProblems of reading file content [modified] Pin
codenoobie31-Jan-10 21:48
codenoobie31-Jan-10 21:48 
Hi all, I'm currently using C# and Windows Mobile 6. I've succeeded in exporting data from the datagrid to the selected directories in the mobile. However, when I access the file, an error messaged popped out, "There is no application associated with "file" run the application first, then open this file from within the application." And one more thing, when I send the file to my email address, I can read the contents from the file. Why can't I read the file contents from the mobile? The code below is my code snippet. Please take a look, any help would be appreciated. Thanks in advance. =)

private void btnExport_Click(object sender, EventArgs e)
        {
           
            SqlCeDataReader reader;
            SqlCeConnection conn = new SqlCeConnection(connStr);
           
           
          
            



                conn.Open();//open connection


                SqlCeCommand cmd = new SqlCeCommand("SELECT No, DateAndTime, LocationInformation FROM Location", conn);
                cmd.ExecuteNonQuery();

              
              
                 reader = cmd.ExecuteReader();

                
                //the "using" statement causes the close method to be called internally.
                //if "using" not used, use "writer.Close()" in try-catch-finally explicitly




                 using (StreamWriter writer = new StreamWriter("\\Program Files\\file.csv", true))
            { //false means: file is overwritten
                try
                {
                    while (reader.Read())
                    {
                        writer.Write(reader["No"]);
                        writer.Write("#");
                        writer.Write(reader["DateAndTime"]);
                        writer.Write("#");
                        writer.Write(reader["LocationInformation"]);
                        writer.WriteLine(); //next new line			
                    }//while 
                }
                catch (Exception excp)
                {
                    MessageBox.Show(excp.Message);
                }
                finally
                {
                   
                    reader.Close(); //close the reader
                    conn.Close();
                }//try-catch
            }//using  	  
            MessageBox.Show("Data of table writtten into \\Program Files\\file.csv file", "Writing completed");

         }


modified on Monday, February 1, 2010 4:34 AM

AnswerRe: Problems of reading file content Pin
Richard MacCutchan1-Feb-10 0:16
mveRichard MacCutchan1-Feb-10 0:16 
GeneralRe: Problems of reading file content Pin
codenoobie1-Feb-10 2:37
codenoobie1-Feb-10 2:37 
GeneralRe: Problems of reading file content Pin
Richard MacCutchan1-Feb-10 4:25
mveRichard MacCutchan1-Feb-10 4:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.