I am trying to create WinForm accounting application using c# and Microsoft Visual Studio. I want to create a new column in the table. The column name should be fetch from the datepicker.
form1.cs
private void button5_Click(object sender, EventArgs e)
{
CON.Open();
SqlDataAdapter SDA = new SqlDataAdapter("alter table SAMPLETABLE add "+dateTimePicker1.Text + " VARCHAR[50]", CON);
SDA.SelectCommand.ExecuteNonQuery();
CON.Close();
MessageBox.Show("CREATED SUCCESSFULLY");
}
When run the program, which showing an error
"The definition for column Thursday' must include a data type."