Click here to Skip to main content
15,903,012 members
Home / Discussions / C#
   

C#

 
QuestionHow to know toolbar got clicked through a BHO (C#)? Pin
svt gdwl31-Jul-09 0:05
svt gdwl31-Jul-09 0:05 
Questioncode for updating datatable. Pin
Omar Akhtar Sheikh30-Jul-09 23:46
Omar Akhtar Sheikh30-Jul-09 23:46 
AnswerRe: code for updating datatable. Pin
Not Active30-Jul-09 23:51
mentorNot Active30-Jul-09 23:51 
JokeRe: code for updating datatable. Pin
Nagy Vilmos31-Jul-09 0:01
professionalNagy Vilmos31-Jul-09 0:01 
GeneralRe: code for updating datatable. Pin
PIEBALDconsult31-Jul-09 4:55
mvePIEBALDconsult31-Jul-09 4:55 
AnswerRe: code for updating datatable. Pin
PIEBALDconsult31-Jul-09 4:54
mvePIEBALDconsult31-Jul-09 4:54 
AnswerRe: code for updating datatable. Pin
Adam R Harris31-Jul-09 8:05
Adam R Harris31-Jul-09 8:05 
GeneralRe: code for updating datatable. Pin
Omar Akhtar Sheikh31-Jul-09 8:27
Omar Akhtar Sheikh31-Jul-09 8:27 
Kindly would you please help me code the whole thing because it is urgent and I still want to do it my own way. Please help it is emergency, my daughter is in hospital, I have loads of tension on my mind due to her.

<code> // Dont know if this is going to be accessed outside of the class
                           // If so you might want to make a wrapper property for it
                           private SqlDataAdapter da;
                           // Should contain your data
                           private DataSet ds;

                           ..... somewhere in your initialization code .....
                           da = new SqlDataAdapter("SELECT * FROM Customer_2", [YourConnectionString]);
                           da.UpdateCommand = [your update command];
                           da.DeleteCommand = [your delete command];
                           da.InsertCommand = [your insert command];

                           // dont return anything here, just fill the dataset
                           public void GetCustomers()
                           {
                                       da.Fill(ds);
                           }

                           // Saves all the changes to the database
                           public void SaveChanges()
                           {
                                       da.Update(ds, "[your table name]");
                                       // Accept the changes in the dataset
                                       ds.AcceptChanges();
                           }
The following is the more code for deleting from my datagridview for removal not only from datagridview but also from database as well.

List<int>customerIDsToDelete = new List<int>();

            private void btnDELETE_Click(object sender, EventArgs e)
            {
                  // Iterate all the Rows in DataGridView Rows Collection
                  foreach (DataGridViewRow row in dataGridView1.Rows)
                  {
                        // Get the status of CheckBox in the current Row
                        bool deleteStatus = Convert.ToBoolean(row.Cells[0].Value);

                        // Get the CashierID of the Cashier in the current row
                        int customerID = Convert.ToInt32(row.Cells[1].Value);

                        if (deleteStatus)
                        {
                              row.Selected = true;
                              customerIDsToDelete.Add(customerID);
                        }
                  }

                  // Remove From DataGridView

                  foreach (DataGridViewRow selectedRow in dataGridView1.SelectedRows)
                  {
                        dataGridView1.Rows.Remove(selectedRow);
                  }


                  // Remote From Database

                  DALHelper dal = new DALHelper();
                  dal.DeleteCustomers(customerIDsToDelete);

                  customerIDsToDelete.Clear();

                  // Load Cashiers from Database

                  LoadCustomers();
                 
            }


</code>
GeneralRe: code for updating datatable. Pin
Adam R Harris31-Jul-09 9:16
Adam R Harris31-Jul-09 9:16 
General[Message Deleted] Pin
Omar Akhtar Sheikh31-Jul-09 11:56
Omar Akhtar Sheikh31-Jul-09 11:56 
GeneralRe: code for updating datatable. Pin
Adam R Harris31-Jul-09 12:14
Adam R Harris31-Jul-09 12:14 
QuestionProblem in Filter Grid Pin
SwastikInfosystems30-Jul-09 23:29
SwastikInfosystems30-Jul-09 23:29 
AnswerRe: Problem in Filter Grid Pin
OriginalGriff30-Jul-09 23:54
mveOriginalGriff30-Jul-09 23:54 
AnswerRe: Problem in Filter Grid Pin
stancrm30-Jul-09 23:55
stancrm30-Jul-09 23:55 
AnswerRe: Problem in Filter Grid Pin
Nagy Vilmos30-Jul-09 23:59
professionalNagy Vilmos30-Jul-09 23:59 
QuestionProblem in Filter Grid Pin
SwastikInfosystems30-Jul-09 23:17
SwastikInfosystems30-Jul-09 23:17 
AnswerRe: Problem in Filter Grid Pin
Vimalsoft(Pty) Ltd31-Jul-09 0:06
professionalVimalsoft(Pty) Ltd31-Jul-09 0:06 
Questiongive me a code for disable keyboard functions this project............ [modified] Pin
Member 423560130-Jul-09 22:28
Member 423560130-Jul-09 22:28 
AnswerRe: Add to disable keyboard functions this project............ Pin
OriginalGriff30-Jul-09 23:16
mveOriginalGriff30-Jul-09 23:16 
GeneralRe: Add to disable keyboard functions this project............ Pin
Luc Pattyn30-Jul-09 23:36
sitebuilderLuc Pattyn30-Jul-09 23:36 
GeneralRe: Add to disable keyboard functions this project............ Pin
Baeltazor31-Jul-09 7:17
Baeltazor31-Jul-09 7:17 
GeneralRe: Add to disable keyboard functions this project............ Pin
OriginalGriff31-Jul-09 8:12
mveOriginalGriff31-Jul-09 8:12 
GeneralRe: <blockquote class="FQ"><div class="FQA">OriginalGriff wrote:</div>Fraid so...Umpteen[^]</blockquote> Pin
Baeltazor31-Jul-09 10:01
Baeltazor31-Jul-09 10:01 
Questionusing statement Vs Dispose/Finalize pattern Pin
Cracked-Down30-Jul-09 21:28
Cracked-Down30-Jul-09 21:28 
AnswerRe: using statement Vs Dispose/Finalize pattern Pin
Christian Graus30-Jul-09 22:00
protectorChristian Graus30-Jul-09 22:00 

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.