Click here to Skip to main content
16,014,671 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
private void BindsearchInventoryDateOUT()
        {
            MySqlConnection con = new MySqlConnection("Server=localhost;UID=root;Database=db_cignal");
            DataTable dt = new DataTable();
            MySqlDataAdapter da = new MySqlDataAdapter("SELECT * FROM inventoryout WHERE Date like '" + txtSearchInventory.Text + "%'", con);
            da.Fill(dt);

            dataGridView4.DataSource = dt;
            con.Close();
        }
Posted
Updated 24-Mar-15 21:51pm
v2
Comments
Sinisa Hajnal 25-Mar-15 3:53am    
Why not search for the answer instead of asking?
http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html

You code is vulnerable to SQL Injection, do NOT EVER use outside input withour checking its content. With access to your textbox one could drop our inventory table or database without even trying hard.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900