G Guest Aug 17, 2007 #2 Hi Tina, SqlDataSource is component used for databinding. If you need to fill DataTable in your code use SqlDataAdapter instead. DataTable table = new DataTable(); using (SqlConnection conn = new SqlConnection(myConnectionString)) { SqlDataAdapter adapter = new SqlDataAdapter(); adapter.SelectCommand = new SqlCommand("some database query", conn); adapter.Fill(table); } Best regards, Ladislav
Hi Tina, SqlDataSource is component used for databinding. If you need to fill DataTable in your code use SqlDataAdapter instead. DataTable table = new DataTable(); using (SqlConnection conn = new SqlConnection(myConnectionString)) { SqlDataAdapter adapter = new SqlDataAdapter(); adapter.SelectCommand = new SqlCommand("some database query", conn); adapter.Fill(table); } Best regards, Ladislav