Click here to Skip to main content
15,914,016 members
Home / Discussions / C#
   

C#

 
GeneralRe: Not able to delete original jpeg file after it is copied with System.IO.File.Copy() Pin
Dave Kreskowiak5-Sep-10 11:11
mveDave Kreskowiak5-Sep-10 11:11 
AnswerRe: Not able to delete original jpeg file after it is copied with System.IO.File.Copy() Pin
Pete O'Hanlon5-Sep-10 7:29
mvePete O'Hanlon5-Sep-10 7:29 
GeneralRe: Not able to delete original jpeg file after it is copied with System.IO.File.Copy() Pin
Aseem Sharma5-Sep-10 20:02
Aseem Sharma5-Sep-10 20:02 
GeneralRe: Not able to delete original jpeg file after it is copied with System.IO.File.Copy() Pin
NarVish6-Sep-10 0:04
NarVish6-Sep-10 0:04 
GeneralRe: Not able to delete original jpeg file after it is copied with System.IO.File.Copy() Pin
Pete O'Hanlon6-Sep-10 0:33
mvePete O'Hanlon6-Sep-10 0:33 
GeneralRe: Not able to delete original jpeg file after it is copied with System.IO.File.Copy() Pin
NarVish6-Sep-10 1:39
NarVish6-Sep-10 1:39 
QuestionProblem : Need to make COM InterOp at runtime using reflections Passing Pointers as parameters? Pin
glitteringsound4-Sep-10 20:23
glitteringsound4-Sep-10 20:23 
Questioncreating an own file for my application Pin
prasadbuddhika4-Sep-10 6:50
prasadbuddhika4-Sep-10 6:50 
AnswerRe: creating an own file for my application Pin
Not Active4-Sep-10 7:34
mentorNot Active4-Sep-10 7:34 
AnswerRe: creating an own file for my application Pin
DaveyM694-Sep-10 7:54
professionalDaveyM694-Sep-10 7:54 
AnswerRe: creating an own file for my application Pin
DaveAuld4-Sep-10 7:59
professionalDaveAuld4-Sep-10 7:59 
AnswerRe: creating an own file for my application [modified] Pin
Luc Pattyn4-Sep-10 9:20
sitebuilderLuc Pattyn4-Sep-10 9:20 
AnswerRe: creating an own file for my application Pin
OriginalGriff4-Sep-10 10:25
mveOriginalGriff4-Sep-10 10:25 
AnswerRe: creating an own file for my application Pin
Expert Coming4-Sep-10 22:12
Expert Coming4-Sep-10 22:12 
QuestionHii I am working on project and want to get some data from dataset and want to create and ink stroke Pin
googlejumbo4-Sep-10 6:20
googlejumbo4-Sep-10 6:20 
AnswerRe: Hii I am working on project and want to get some data from dataset and want to create and ink stroke Pin
Luc Pattyn4-Sep-10 6:40
sitebuilderLuc Pattyn4-Sep-10 6:40 
QuestionHow to determine and check whether a type in assembly is Custom type or Primitive type using reflection in .NET? Pin
glitteringsound4-Sep-10 5:14
glitteringsound4-Sep-10 5:14 
AnswerRe: How to determine and check whether a type in assembly is Custom type or Primitive type using reflection in .NET? Pin
Not Active4-Sep-10 5:30
mentorNot Active4-Sep-10 5:30 
AnswerRe: How to determine and check whether a type in assembly is Custom type or Primitive type using reflection in .NET? Pin
dan!sh 4-Sep-10 5:33
professional dan!sh 4-Sep-10 5:33 
AnswerRe: How to determine and check whether a type in assembly is Custom type or Primitive type using reflection in .NET? Pin
PIEBALDconsult4-Sep-10 5:59
mvePIEBALDconsult4-Sep-10 5:59 
GeneralRe: How to determine and check whether a type in assembly is Custom type or Primitive type using reflection in .NET? Pin
dan!sh 4-Sep-10 7:41
professional dan!sh 4-Sep-10 7:41 
GeneralRe: How to determine and check whether a type in assembly is Custom type or Primitive type using reflection in .NET? Pin
PIEBALDconsult6-Sep-10 18:35
mvePIEBALDconsult6-Sep-10 18:35 
Questionhow to update listView on all clients machines when new data was added? Pin
kai-best4-Sep-10 5:06
kai-best4-Sep-10 5:06 
i'm writing a little app that works with MySQL database. my app connects to MySQL server (for now it's a localhost) and works with it. it should do all the basic things like reading, adding, inserting, updating, deleting... i just started learning C#, and having little difficulties with it.

my app is used by 4 people, when one of them adds new data to database i want it to reflect in every client app that's running.

code that adds data to listView:

private void Form1_Load(object sender, EventArgs e)
        {
            string myConnectionString = "SERVER=localhost;" + "DATABASE=database;" + "UID=root;" + "PASSWORD=123123;";
            MySqlConnection conn;
            conn = new MySqlConnection();
            conn.ConnectionString = myConnectionString;

            try
            {
                conn.Open();

                string sql = "SELECT * FROM table";
                MySqlCommand cmd = new MySqlCommand(sql, conn);
                MySqlDataReader rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    ListViewItem item = new ListViewItem("" + rdr[0]); // by the way why it doesn't work if i omit "" + ?
                    item.SubItems.Add("" + rdr[1]); // i have to add empty string for it to work...
                    item.SubItems.Add("" + rdr[2]);
                    item.SubItems.Add("" + rdr[3]);
                    item.SubItems.Add("" + rdr[4]);
                    item.SubItems.Add("" + rdr[5]);
                    item.SubItems.Add("" + rdr[6]);
                    item.SubItems.Add("" + rdr[7]);
                    item.SubItems.Add("" + rdr[8]);
                    item.SubItems.Add("" + rdr[9]);
                    item.SubItems.Add("" + rdr[10]);
                    listView1.Items.Add(item);
                }
                rdr.Close();

            }
            catch (MySqlException ex)


so that's what happening when the form loads. probably not the best... guide me here too pls...

and that's how i add new data:

private void addButton_Click(object sender, EventArgs e)
        {
            string myConnectionString = "SERVER=localhost; DATABASE=database; UID=root; PASSWORD=123123;charset=utf8";
            MySqlConnection conn;
            conn = new MySqlConnection();
            conn.ConnectionString = myConnectionString;

            try
            {
                conn.Open();
                string sql = "INSERT INTO table VALUES ('', '" + textBox1.Text + "', '" +textBox2.Text + "', '" + textBox3.Text + "', '0', '0', '0', '0', '0', '0', '0')";
                MySqlCommand cmd = new MySqlCommand(sql, conn);
                cmd.ExecuteNonQuery();
            }
            catch (Exception ex)


so how should i let every client app know that the new data was added and update the listView? thanks
AnswerRe: how to update listView on all clients machines when new data was added? Pin
Not Active4-Sep-10 5:41
mentorNot Active4-Sep-10 5:41 
GeneralRe: how to update listView on all clients machines when new data was added? Pin
kai-best5-Sep-10 2:23
kai-best5-Sep-10 2:23 

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.