OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source = C:\Documents and Settings\Developers\My Documents\Visual Studio 2005\Projects\ITDivision\ITDivision\ITDivision.mdb");
            {
                string referenceNo = referenceNoTextBox.Text.ToString();
                string institutionName = institutionNameTextBox.Text.ToString();
                string fullName = fullNameTextBox.Text.ToString();
                string contacts = contactsTextBox.Text.ToString();
                string itemName = itemNameTextBox.Text.ToString();
                string serialNumber = serialNumberTextBox.Text.ToString();
                string problemInfo = problemInfoTextBox.Text.ToString();
                string technicianName = technicianNameTextBox.Text.ToString();
                string serviceStatus = serviceStatusTextBox.Text.ToString();
                string collectorName = collectorNameTextBox.Text.ToString();
                string checkInDate = checkInDateDateTimePicker.Text.ToString();
                string checkOutDate = checkOutDateDateTimePicker.Text.ToString();

                OleDbCommand addSchools = new OleDbCommand(
                      "UPDATE SCHOOLS(" +
                      "  referenceNo, institutionName, fullName, contacts,itemName, serialNumber, problemInfo, technicianName, serviceStatus, collectorName, checkInDate, checkOutDate)" +
                      "  VALUES( @referenceNo, @institutionName, @fullName, @contacts,@itemName, @serialNumber, @problemInfo, @technicianName, @serviceStatus,@collectorName, @checkInDate, checkOutDate )", conn);
                addSchools.Parameters.Add("@referenceNo", OleDbType.VarChar, 50).Value = referenceNo;
                addSchools.Parameters.Add("@institutionName", OleDbType.VarChar, 50).Value = institutionName;
                addSchools.Parameters.Add("@fullName", OleDbType.VarChar, 50).Value = fullName;
                addSchools.Parameters.Add("@contacts", OleDbType.VarChar, 50).Value = contacts;
                addSchools.Parameters.Add("@itemName", OleDbType.VarChar, 50).Value = itemName;
                addSchools.Parameters.Add("@serialNumber", OleDbType.VarChar, 50).Value = serialNumber;
                addSchools.Parameters.Add("@problemInfo", OleDbType.VarChar, 50).Value = problemInfo;
                addSchools.Parameters.Add("@technicianName", OleDbType.VarChar, 50).Value = technicianName;
                addSchools.Parameters.Add("@serviceStatus", OleDbType.VarChar, 50).Value = serviceStatus;
                addSchools.Parameters.Add("@collectorName", OleDbType.VarChar, 50).Value = collectorName;
                addSchools.Parameters.Add("@checkInDate", OleDbType.VarChar, 50).Value = checkInDate;
                addSchools.Parameters.Add("@checkOutDate", OleDbType.VarChar, 50).Value = checkOutDate;

                conn.Open();
                addSchools.ExecuteNonQuery();
                conn.Close();

                reset();
                MessageBox.Show("Record updated!");
            }

Thanx for the tip,can anyone helpme with this code,it gives me Syntax error in UPDATE statement. when i click on update. Can someone please help mefix this error.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.