//try
//{
// connection = new SqlConnection(sq.qwetext);
// SqlCommand command = new SqlCommand("Select * from Products", connection);
// adapter = new SqlDataAdapter(command);
// adapter.InsertCommand = new SqlCommand("InsertProducts", connection);
// adapter.InsertCommand.CommandType = CommandType.StoredProcedure;
// adapter.InsertCommand.Parameters.Add(new SqlParameter("@name", SqlDbType.NVarChar, 50, "Product_name"));
// adapter.InsertCommand.Parameters.Add(new SqlParameter("
@count", SqlDbType.Int, 0, "Count"));
// adapter.InsertCommand.Parameters.Add(new SqlParameter("
@price_buy", SqlDbType.Int, 0, "Price_buy"));
// adapter.InsertCommand.Parameters.Add(new SqlParameter("
@price_sell", SqlDbType.Int, 0, "Price_Sell"));
// adapter.InsertCommand.Parameters.Add(new SqlParameter("
@data_buy", SqlDbType.DateTime, 0, "Data_buy"));
// adapter.InsertCommand.Parameters.Add(new SqlParameter("
@category", SqlDbType.NVarChar, 50, "Category"));
// adapter.InsertCommand.Parameters.Add(new SqlParameter("
@parent", SqlDbType.Int, 0, "Parent"));
// SqlParameter parameter = adapter.InsertCommand.Parameters.Add("@Id", SqlDbType.Int, 0, "ID");
// parameter.Direction = ParameterDirection.Output;
// connection.Open();
// adapter.Fill(Product);
// Grid1.ItemsSource = Product.DefaultView;
//}
//catch (Exception ex)
//{
// MessageBox.Show(ex.Message);
//}
//finally
//{
// if (connection != null)
// connection.Close();
//}