Marvin kakuru

Marvin kakuru

  • 1.4k
  • 355
  • 160.1k

Inserting Date Value

Jul 17 2011 4:48 AM
Hi all i am trying to insert a string of data into an sql database table from a number of textboxes, however the date value 17/07/2011 in my textbox4 is not being inserted and haulting the whole processes.

Below is the code i am using



string insertString = "insert into Herdregistar(month,uic,motheruic,mother,name,animalsex,tagno,status,owner,presence,year,wkno,day,date) values ('" + textBox6.Text + "','" + textBox11.Text + "','" + textBox8.Text + "','" + textBox9.Text + "','" + textBox12.Text + "','" + comboBox3.Text + "','" + textBox13.Text + "','" + comboBox1.Text + "','" + textBox15.Text + "','" + comboBox4.Text + "','" + textBox7.Text + "','" + textBox5.Text + "','" + textBox3.Text + "','" + textBox4.Text + "')"SqlCommand
cmd.ExecuteNonQuery();
cmd = new SqlCommand(insertString, conn);
in my sql database i have set the value of the date column as "Date"

your kind advice will be highly appreciated.
Best regards



Answers (7)