public void dobTipZan(dobType dobType) //добавление занятий { cnn.Open(); comand = cnn.CreateCommand(); comand.CommandText = "INSERT INTO TypeZanaytia (Name_Type) VALUES (@Name_Type)"; comand.Parameters.AddWithValue("@Name_Type", Convert.ToString(dobType.dobTypeTxt.Text)); comand.ExecuteNonQuery(); cnn.Close(); }
public void TipZan(dobType dobType) //выгрузка типа занятий { cnn.Open(); zapros = ("SELECT Name_Type AS [Тип занятия] FROM Courses.dbo.TypeZanaytia"); SqlDataAdapter da = new SqlDataAdapter(zapros, cnn); SqlCommandBuilder cb = new SqlCommandBuilder(da); DataSet ds = new DataSet(); da.Fill(ds, "TypeZanaytia"); dobType.DataType.DataSource = ds.Tables[0]; cnn.Close(); }