7
Answers

Inserting Date Value

Marvin kakuru

Marvin kakuru

13y
2.3k
1
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)