Click here to Skip to main content
15,897,226 members
Home / Discussions / C#
   

C#

 
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 
GeneralRe: Problems of reading file content Pin
codenoobie1-Feb-10 19:02
codenoobie1-Feb-10 19:02 
QuestionC# Vb6.0 Com Interop Pin
Q2A31-Jan-10 21:33
Q2A31-Jan-10 21:33 
AnswerRe: C# Vb6.0 Com Interop Pin
Richard MacCutchan1-Feb-10 0:18
mveRichard MacCutchan1-Feb-10 0:18 
GeneralRe: C# Vb6.0 Com Interop Pin
Thomas Krojer1-Feb-10 1:29
Thomas Krojer1-Feb-10 1:29 
GeneralRe: C# Vb6.0 Com Interop Pin
Richard MacCutchan1-Feb-10 2:00
mveRichard MacCutchan1-Feb-10 2:00 
GeneralRe: C# Vb6.0 Com Interop Pin
Thomas Krojer1-Feb-10 6:25
Thomas Krojer1-Feb-10 6:25 
GeneralRe: C# Vb6.0 Com Interop Pin
Richard MacCutchan1-Feb-10 6:34
mveRichard MacCutchan1-Feb-10 6:34 
GeneralRe: C# Vb6.0 Com Interop Pin
Thomas Krojer1-Feb-10 20:40
Thomas Krojer1-Feb-10 20:40 
GeneralRe: C# Vb6.0 Com Interop Pin
Richard MacCutchan1-Feb-10 23:22
mveRichard MacCutchan1-Feb-10 23:22 
QuestionTreeView Nodes do not update Pin
googoojkhan31-Jan-10 19:38
googoojkhan31-Jan-10 19:38 
AnswerRe: TreeView Nodes do not update Pin
googoojkhan31-Jan-10 21:14
googoojkhan31-Jan-10 21:14 
AnswerRe: TreeView Nodes do not update Pin
Alex Manolescu31-Jan-10 21:28
Alex Manolescu31-Jan-10 21:28 
GeneralRe: TreeView Nodes do not update Pin
Covean31-Jan-10 23:09
Covean31-Jan-10 23:09 
GeneralRe: TreeView Nodes do not update Pin
Alex Manolescu31-Jan-10 23:57
Alex Manolescu31-Jan-10 23:57 

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.