Как я могу вывести значение переменной и вставить в строку шаблона
Hi! All my friends! Please help me, it’s my first project for airport (student practice). I’m learning coding C# My Data base connected to forms DataGridView and I see any changes real time (used SqlDependency). Next step, how can I do for example when changes one column in Database (flight condition) withdraw “flight_number, destination_airport” and paste this information (variable value) in template string “Dear passenger ''flight_number'' to ''destination_airport'' was canceled. (passenger display notifications). How can I do for C#, please give an example code. sorry my English, i hope you understand me. Thank you!
Что я уже пробовал:
//Load Data void LoadData() { DataTable dt = new DataTable(); if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("SELECT flight_number, destination_airport, flight_status, checkin_place, gate FROM DFP", con); cmd.Notification = null; SqlDependency de = new SqlDependency(cmd); de.OnChange += new OnChangeEventHandler(de_OnChange); dt.Load(cmd.ExecuteReader(CommandBehavior.CloseConnection)); dataGridView1.DataSource = dt; } public void de_OnChange(object sender, SqlNotificationEventArgs e) { SqlDependency de = sender as SqlDependency; de.OnChange -= de_OnChange; if (OnNewHome != null) { OnNewHome(); } } }
NotPolitcallyCorrect
строка.Формат