Click here to Skip to main content
15,896,606 members
Home / Discussions / C#
   

C#

 
GeneralRe: Can I write programs in C # to Micro Controllers Pin
OriginalGriff1-Aug-09 4:58
mveOriginalGriff1-Aug-09 4:58 
AnswerRe: Can I write programs in C # to Micro Controllers [modified] Pin
mustang861-Aug-09 16:32
mustang861-Aug-09 16:32 
GeneralRe: Can I write programs in C # to Micro Controllers Pin
OriginalGriff2-Aug-09 0:45
mveOriginalGriff2-Aug-09 0:45 
QuestionCreate DAL/ BLL Pin
Chazzysb1-Aug-09 1:23
Chazzysb1-Aug-09 1:23 
AnswerRe: Create DAL/ BLL Pin
Eddy Vluggen1-Aug-09 7:13
professionalEddy Vluggen1-Aug-09 7:13 
AnswerRe: Create DAL/ BLL Pin
Not Active1-Aug-09 9:15
mentorNot Active1-Aug-09 9:15 
QuestionImplementation help. Cheers Guys!! Pin
PSMITH821-Aug-09 0:25
PSMITH821-Aug-09 0:25 
QuestionError: Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information. Pin
Omar Akhtar Sheikh31-Jul-09 23:58
Omar Akhtar Sheikh31-Jul-09 23:58 
I am using a datagridview with an INSERT, DELETE and an UPDATE button. But whenever I run my form the error that I have stated above rises. Kindly help me to solve this problem.

<code>
            string constr = "Server=PACE-BB95D506B2; Database=Dotnet67;                                                                                                                  uid=sa; pwd=123";
                       
            private void button1_Click(object sender, EventArgs e)
            {
                  this.Close();
            }
           
           
            DataTable table = null;
            SqlDataAdapter da = null;

            private void LoadCashiers()
            {
                  string query = "SELECT * FROM Cashier_2";
                  da = new SqlDataAdapter(query, constr);
                  table = new DataTable();
                  da.Fill(table);

                  dataGridView1.DataSource = table;
                  dataGridView1.Refresh();

                  SqlCommandBuilder b = new SqlCommandBuilder(da);
                 
               // The error rises in the line of code below
                  da.UpdateCommand = b.GetUpdateCommand();
            }
                             

            private void ManageCashier_Load(object sender, EventArgs e)
            {
           
                  LoadCashiers();

            }

                             
            private void btnLoadCashiers_Click(object sender, EventArgs e)
            {
                  LoadCashiers();
            }

            private void btnInsertCashier_Click(object sender, EventArgs e)
            {
                  DALHelper helper = new DALHelper();
                  helper.InsertCashier(textBox1.Text);
                  LoadCashiers();
            }


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

            private void btnDelete_Click(object sender, EventArgs e)
            {
               foreach (DataGridViewRow row in dataGridView1.Rows)
                  {
                  bool deleteStatus = Convert.ToBoolean(row.Cells[0].Value);
  
                        int cashierID = Convert.ToInt32(row.Cells[1].Value);
                       
                        if (deleteStatus)
                        {
                              row.Selected = true;
                              cashierIDsToDelete.Add(cashierID);
                        }
                  }
              
                  foreach (DataGridViewRow selectedRow in dataGridView1.SelectedRows)
                  {
                        dataGridView1.Rows.Remove(selectedRow);
                  }

                  DALHelper dal = new DALHelper();
                  dal.DeleteCashiers(cashierIDsToDelete);

                  cashierIDsToDelete.Clear();

                  // Load Cashiers from Database

                  LoadCashiers();
           
            }

            private void btnUpdate_Click(object sender, EventArgs e)
            {
                  da.Update(table);
                  MessageBox.Show("Update");
            }

            }
</code>
AnswerRe: Error: Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information. Pin
Moreno Airoldi1-Aug-09 2:00
Moreno Airoldi1-Aug-09 2:00 
Questiondisplay text in textbox Pin
Abdul Rahman Hamidy31-Jul-09 22:26
Abdul Rahman Hamidy31-Jul-09 22:26 
AnswerRe: display text in textbox Pin
OriginalGriff31-Jul-09 22:44
mveOriginalGriff31-Jul-09 22:44 
GeneralRe: display text in textbox Pin
Abdul Rahman Hamidy31-Jul-09 22:53
Abdul Rahman Hamidy31-Jul-09 22:53 
GeneralRe: display text in textbox Pin
AhsanS31-Jul-09 23:05
AhsanS31-Jul-09 23:05 
GeneralRe: display text in textbox Pin
OriginalGriff31-Jul-09 23:21
mveOriginalGriff31-Jul-09 23:21 
GeneralRe: display text in textbox Pin
Abdul Rahman Hamidy1-Aug-09 1:38
Abdul Rahman Hamidy1-Aug-09 1:38 
GeneralRe: display text in textbox Pin
Henry Minute1-Aug-09 2:10
Henry Minute1-Aug-09 2:10 
GeneralRe: display text in textbox Pin
OriginalGriff1-Aug-09 4:47
mveOriginalGriff1-Aug-09 4:47 
GeneralRe: display text in textbox Pin
DaveyM691-Aug-09 9:12
professionalDaveyM691-Aug-09 9:12 
GeneralRe: display text in textbox Pin
OriginalGriff1-Aug-09 22:24
mveOriginalGriff1-Aug-09 22:24 
GeneralRe: display text in textbox Pin
Abdul Rahman Hamidy1-Aug-09 18:07
Abdul Rahman Hamidy1-Aug-09 18:07 
GeneralRe: display text in textbox Pin
OriginalGriff1-Aug-09 22:22
mveOriginalGriff1-Aug-09 22:22 
GeneralRe: display text in textbox Pin
Abdul Rahman Hamidy2-Aug-09 1:01
Abdul Rahman Hamidy2-Aug-09 1:01 
GeneralRe: display text in textbox Pin
OriginalGriff2-Aug-09 1:24
mveOriginalGriff2-Aug-09 1:24 
GeneralRe: display text in textbox Pin
Abdul Rahman Hamidy2-Aug-09 17:54
Abdul Rahman Hamidy2-Aug-09 17:54 
QuestionGlobalAppointmentID Pin
248912831-Jul-09 22:12
248912831-Jul-09 22:12 

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.