Spaces.
You need to add one between the id value and the word "and":
SqlCommand cmd4 = new SqlCommand("select * from call_details where id="+ds3.Tables[0]+"and enquiry_date between '" + txt_datefrom.Text + "' and '" + txt_dateto.Text + "'", cnn);
Becomes:
SqlCommand cmd4 = new SqlCommand("select * from call_details where id="+ds3.Tables[0]+" and enquiry_date between '" + txt_datefrom.Text + "' and '" + txt_dateto.Text + "'", cnn);
"i have to fetch not only single id,but from first query multiple id's comming .And that id's i have to use in second query."
Right. Ok...that's a different problem altogether.
You can't just provide a datatable to a query and expect it to sort it all out - the syntax just isn't there. For one thing, SQL has no concept of an array which makes it all rather difficult.
There are two ways to do it:
1) Convert the ID's to comma separated values, and use the IN clause in your second query:
SELECT * FROM MyTable WHERE id IN (1, 2, 3, 4)
This works fine for small numbers of ID, but can get to be a problem with larger ones (as you start to spend more time processing the SQL command than accessing the database!)
List<string> ids = new List<string>();
foreach (DataRow row in dt.Rows)
{
ids.Add(row.ItemArray[0].ToString());
}
string s = String.Join(",", ids);
Will generate the CSV data.
2) Use a JOIN query. This looks up the IDs in one table, and uses them in the other.
Depending on how far you are in your course, you may not have covered these yet, so I'm reluctant to introduce them. (But they are a much better solution)