I NEED HELP WITH THIS BUTTON IVE ATTACHED THE FORM AND CODE ERROR.

public partial class Client : Form
    {
        public Client()
        {
            InitializeComponent();
        }

        private void clientsBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            this.Validate();
            this.clientsBindingSource.EndEdit();
            this.clientsTableAdapter.Update(this.dataSet.clients);

        }

        private void Client_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'dataSet.clients' table. You can move, or remove it, as needed.
            this.clientsTableAdapter.Fill(this.dataSet.clients);

        }

        private void radioButton2_CheckedChanged(object sender, EventArgs e)
        {

        }

        private void closeBtn_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void clearBtn_Click(object sender, EventArgs e)
        {
            clientIDTextBox.Text = "";
            tittleTextBox.Text = "";
            client_F_NameTextBox.Text = "";
            client_L_NameTextBox.Text = "";
            technicianIDTextBox.Text = "";
            item_NameTextBox.Text = "";
            statusTextBox.Text = "";
            office_NoTextBox.Text = "";
            emailTextBox.Text = "";
            tel_NoTextBox.Text = "";
            extension_NoTextBox.Text = "";
            serial_NoTextBox.Text = "";
            call_NoTextBox.Text = "";
            addressTextBox.Text = "";
        }

        private void saveBtn_Click(object sender, EventArgs e)
        {
            OleDbConnection conn = new OleDbConnection(@"provider = Microsoft.Jet.OLEDB.4.0;Data Source= C:\Documents and Settings\Developers ITD\My Documents\Visual Studio 2005\Projects\Jackson\Jackson\call.mdb");

            {
                string client_ID = clientIDTextBox.Text.ToString();
                string title = tittleTextBox.Text.ToString();
                string client_f_name = client_F_NameTextBox.Text.ToString();
                string client_l_name = client_L_NameTextBox.Text.ToString();
                string technician_ID = technicianIDTextBox.Text.ToString();
                string item_name = item_NameTextBox.Text.ToString();
                string status = statusTextBox.Text.ToString();
                string email = emailTextBox.Text.ToString();
                string tel_no = tel_NoTextBox.Text.ToString();
                string extension_no = extension_NoTextBox.Text.ToString();
                string serial_no = serial_NoTextBox.Text.ToString();
                string call_no = call_NoTextBox.Text.ToString();
                string address = addressTextBox.Text.ToString();
                string date_assigned = date_AssignedDateTimePicker.Text.ToString();
                string office_no = office_NoTextBox.Text.ToString();

                OleDbCommand addpro = new OleDbCommand(
                "INSERT INTO Client (" +
                "CLIENTID, TITLE, CLIENT_F_NAME, CLIENT_L_NAME, TECHNICIANID, ITEM_NAME, STATUS, EMAIL, TEL_NO, EXTENSION_NO, SERIAL_NO, CALL_NO, ADDRESS, DATE_ASSIGNEDDATETIMEPICKER, OFFICE_NO)" +
                "VALUES(@CLIENTID, @TITLE, @CLIENT_F_NAME, @CLIENT_L_NAME, @TECHNICIANID, @ITEM_NAME, @STATUS, @EMAIL, @TEL_NO, @EXTENSION_NO, 2SERIAL_NO, @CALL_NO, @ADDRESS, @DATE_ASSIGNEDDATETIMEPICKER, @OFFICE_NO)", conn);

                addpro.Parameters.Add("@CLIENTID", OleDbType.VarChar, 50).Value = client_f_name;
                addpro.Parameters.Add("@TITLE", OleDbType.VarChar, 50).Value = title;
                addpro.Parameters.Add("@CLIENT_F_NAME", OleDbType.VarChar, 50).Value = client_f_name;
                addpro.Parameters.Add("@CLIENT_L_NAME", OleDbType.VarChar, 50).Value = client_l_name;
                addpro.Parameters.Add("@TECHNICIANID", OleDbType.VarChar, 50).Value = technician_ID;
                addpro.Parameters.Add("@ITEM_NAME", OleDbType.VarChar, 50).Value = item_name;
                addpro.Parameters.Add("@STATUS", OleDbType.VarChar, 50).Value = status;
                addpro.Parameters.Add("@EMAIL", OleDbType.VarChar, 50).Value = email;
                addpro.Parameters.Add("@TEL_NO", OleDbType.VarChar, 50).Value = tel_no;
                addpro.Parameters.Add("@EXTENSION_NO", OleDbType.VarChar, 50).Value = extension_no;
                addpro.Parameters.Add("@SERIAL_NO", OleDbType.VarChar, 50).Value = serial_no;
                addpro.Parameters.Add("@CALL_NO", OleDbType.VarChar, 50).Value = call_no;
                addpro.Parameters.Add("@ADDRESS", OleDbType.VarChar, 50).Value = address;
                addpro.Parameters.Add("@DATE_ASSIGNEDDATETIMEPICKER", OleDbType.VarChar, 50).Value = date_AssignedDateTimePicker;
                addpro.Parameters.Add("@OFFICE_NO", OleDbType.VarChar, 50).Value = office_no;

                //open the connection and INSERT the BLOB into the Database
                conn.Open();
                [U]addpro.ExecuteNonQuery();[/U]

                conn.Close();

                MessageBox.Show("Save Successfull");
            }
        }

        private void new_employeeBtn_Click(object sender, EventArgs e)
        {
            New_Employee Main = new New_Employee();
            Main.Show();
            this.Hide();
        }

        private void change_passwordBtn_Click(object sender, EventArgs e)
        {
            change_Password Main = new change_Password();
            Main.Show();
            this.Hide();
        }
    }
}

Edited 6 Years Ago by __avd: Added [code] tags. For easy readability, always wrap programming code within posts in [code] (code blocks).

Attachments client.jpg 57.18 KB error_code.jpg 154.77 KB
addpro.Parameters.Add("@DATE_ASSIGNEDDATETIMEPICKER", OleDbType.VarChar, 50).Value = date_AssignedDateTimePicker.Value;

I've already tried that code it gives me another Error message: Syntex error (missing opperator) in query expression '2SERIAL_NO'. but thanx for the help

Edited 6 Years Ago by badx: n/a

Can you list the fields and their data type?

Here is an error,

string query="INSERT INTO Client (CLIENTID, TITLE, CLIENT_F_NAME, CLIENT_L_NAME, TECHNICIANID, ITEM_NAME, STATUS, EMAIL, TEL_NO, EXTENSION_NO, SERIAL_NO, CALL_NO, ADDRESS, DATE_ASSIGNEDDATETIMEPICKER, OFFICE_NO) VALUES (@CLIENTID, @TITLE, @CLIENT_F_NAME, @CLIENT_L_NAME, @TECHNICIANID, @ITEM_NAME, @STATUS, @EMAIL, @TEL_NO, @EXTENSION_NO, @SERIAL_NO, @CALL_NO, @ADDRESS, @DATE_ASSIGNEDDATETIMEPICKER, @OFFICE_NO)";

Edited 6 Years Ago by __avd: Added code.

string query: invalid expression term

Edited 6 Years Ago by badx: n/a

Take a look at post #4.

OleDbCommand addpro = new OleDbCommand(
                "INSERT INTO Client (" +
                "CLIENTID, TITLE, CLIENT_F_NAME, CLIENT_L_NAME, TECHNICIANID, ITEM_NAME, STATUS, EMAIL, TEL_NO, EXTENSION_NO, SERIAL_NO, CALL_NO, ADDRESS, DATE_ASSIGNEDDATETIMEPICKER, OFFICE_NO)" +
                "VALUES(@CLIENTID, @TITLE, @CLIENT_F_NAME, @CLIENT_L_NAME, @TECHNICIANID, @ITEM_NAME, @STATUS, @EMAIL, @TEL_NO, @EXTENSION_NO, 2SERIAL_NO, @CALL_NO, @ADDRESS, @DATE_ASSIGNEDDATETIMEPICKER, @OFFICE_NO)", conn);

replace 2 with @.

Tanx alot i ddnt notice the 2, ive tried the code but the application keeps freezin but ill fix that. thanx a lot...

Edited 6 Years Ago by badx: n/a

Therror messages are there to help you find the problem. I know as a novice they can be confusing, but it will help you a lot if you learn to understand what they are telling you.
You said you didnt notice that you had 2SERIAL_NO instead of @SERIAL_NO, but that was exactly what the error message was bringing to your attention:
Syntex error (missing opperator) in query expression '2SERIAL_NO'

Likewise, your first error told you that it had failed to convert a DateTimePicker to a String. This was because you needed to convert the DateTimePicker's Value, not the DateTimePicker itself.

I'm not trying to berate you here, just highlight what you've overlooked. The error messages are there to tell you whats wrong. The operating system doesnt read them, it just logs an error code. The language in the errors is a little technical in places but thats to ensure they relay the issue correctly. Learn what they are telling you and you will be able to problem solve the errors yourself :)

This question has already been answered. Start a new discussion instead.