سلام
باز هم همان پاسخ قبلی است ولی کمی کد عوض میشود :
public Form1()
{
InitializeComponent();
this.numericUpDown1.Value = MyValue();
}
private decimal MyValue()
{
SqlConnection C = new SqlConnection("Data Source=.;Initial Catalog=YourDB;Integrated Security=True");
C.Open();
return decimal.Parse(new SqlCommand("Select YourField From YourTable Where YourWhere...", C).ExecuteScalar().ToString());
}