LalChand

LalChand

  • NA
  • 8
  • 0

String Conversion problem in executing query

Sep 14 2009 5:09 PM
string strConnection = @"server=.\SQLEXPRESS;Database=Northwind ; Integrated Security=SSPI";
string strCommand ="Select * from Orders where OrderDate='"+7/4/1996+"'";
sqlDataAdapter dataAdapter = new SqlDataAdapter(strCommand, strConnection);
DataSet dataSet = new DataSet();
dataAdapter.Fill(dataSet, "Orders");
dataGridView1.DataSource = dataSet.Tables["Orders"].DefaultView;
I want to populate the grid depending upon the date of Orders but my query is not interpreted as select * from Orders where orderDate='7/4/2001';

Answers (3)