Click here to Skip to main content
15,885,309 members
Home / Discussions / C#
   

C#

 
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 
GeneralRe: how to update listView on all clients machines when new data was added? Pin
Not Active5-Sep-10 2:59
mentorNot Active5-Sep-10 2:59 
GeneralRe: how to update listView on all clients machines when new data was added? Pin
OriginalGriff5-Sep-10 4:12
mveOriginalGriff5-Sep-10 4:12 
GeneralRe: how to update listView on all clients machines when new data was added? Pin
Not Active5-Sep-10 5:07
mentorNot Active5-Sep-10 5:07 
GeneralRe: how to update listView on all clients machines when new data was added? Pin
OriginalGriff5-Sep-10 5:15
mveOriginalGriff5-Sep-10 5:15 
AnswerRe: how to update listView on all clients machines when new data was added? Pin
OriginalGriff4-Sep-10 6:05
mveOriginalGriff4-Sep-10 6:05 
GeneralRe: how to update listView on all clients machines when new data was added? Pin
kai-best5-Sep-10 2:29
kai-best5-Sep-10 2:29 
AnswerRe: how to update listView on all clients machines when new data was added? Pin
kai-best5-Sep-10 2:44
kai-best5-Sep-10 2:44 
GeneralRe: how to update listView on all clients machines when new data was added? Pin
OriginalGriff5-Sep-10 4:10
mveOriginalGriff5-Sep-10 4:10 
GeneralRe: how to update listView on all clients machines when new data was added? [modified] Pin
kai-best6-Sep-10 3:22
kai-best6-Sep-10 3:22 
QuestionRule Engine Pin
Shubhabrata Mohanty4-Sep-10 3:45
Shubhabrata Mohanty4-Sep-10 3:45 
AnswerRe: Rule Engine Pin
dan!sh 4-Sep-10 4:40
professional dan!sh 4-Sep-10 4:40 
QuestionUpdating a progress bar in a loop Pin
Keith Vitali4-Sep-10 2:25
Keith Vitali4-Sep-10 2:25 
AnswerRe: Updating a progress bar in a loop Pin
Henry Minute4-Sep-10 3:25
Henry Minute4-Sep-10 3:25 
GeneralRe: Updating a progress bar in a loop Pin
Keith Vitali4-Sep-10 4:26
Keith Vitali4-Sep-10 4:26 
AnswerRe: Updating a progress bar in a loop Pin
PIEBALDconsult4-Sep-10 3:47
mvePIEBALDconsult4-Sep-10 3:47 

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.