0

I have the following code:

private void button3_Click(object sender, EventArgs e)
    {

        dataGridView1.Refresh();
        dataGridView1.Columns.Clear();
        clsMSSQL.clsMSSQL mssql = new clsMSSQL.clsMSSQL(2);
        string sql = ("select CCase.RefNo AS Az, EventTemplate.EventCode AS Vorgang from ikaros.CCase join ikaros.Event on CCase.ID = Event.CCaseID join ikaros.EventTemplate on Event.EventTemplateID  = EventTemplate.ID where EventTemplate.EventCode='IRVB' and Event.EventDate ='date' order by CCase.RefNo ASC");
        mssql.Query(sql);
        mssql.Fetch();
        dataGridView1.ColumnCount = 2;
        dataGridView1.Columns[0].Name = "Aktenzeichen";
        dataGridView1.Columns[1].Name = "Vorgang";

        while (!mssql.eof)
        {
            string[] arr_row = new string[2];


            arr_row[0] = mssql.GetString("Az");
            arr_row[1] = mssql.GetString("Vorgang");
            dataGridView1.Rows.Add(arr_row);
            mssql.Fetch();
        }
        dataGridView1.EndEdit();
        dataGridView1.Refresh();


    }

now I want to make a textbox where someone can put a datetime in and it gets the table of that datetime which was given in the textbox. I did my research and I found out that I need to make the following task a class:

and Event.EventDate ='date' 

So 'date' should be the class which should get the information from the textbox and put it into the SQL Statement. I tried to make my textbox do it but I always make the programm freeze.

Thank you.

Ehsan Sajjad
  • 61,834
  • 16
  • 105
  • 160
Burak
  • 235
  • 1
  • 2
  • 12
  • First you need to validate the date that the use entered (see: https://stackoverflow.com/questions/14314934/validate-the-date-in-textbox). Then you can convert the string to a DateTime object (see: https://stackoverflow.com/questions/919244/converting-a-string-to-datetime). Finally you can output your DateTime object as a formatted string (see: http://www.csharp-examples.net/string-format-datetime/). – Jim Fell Dec 05 '18 at 13:04

1 Answers1

-1

You have to use a special control for this:

These controls, are embed able into Data-grid as well.

György Gulyás
  • 1,290
  • 11
  • 37