Kategori: C#

Umut Yazılım - Hayatı kolaylaştıran çözümler.

checklistbox doldurma

if (SqlClass.dsGenel.Tables.Contains(“tblMarkalar”)){SqlClass.dsGenel.Tables.Remove(“tblMarkalar”);SqlClass.dsGenel.Tables.Remove(“tblMarkalar”);}string sqlCumle = “SELECT [MARKA] FROM [Erdemler].[dbo].[Umt_055_Markalar] ORDER BY MARKA”;SqlClass.dsGenel = SqlClass.GetDataset(sqlCumle, “tblMarkalar”); for (int i = 0; i < SqlClass.dsGenel.Tables[“tblMarkalar”].Rows.Count; i++){this.checkedListBoxControl1.Items.Add(SqlClass.dsGenel.Tables[“tblMarkalar”].Rows[i][“MARKA”].ToString());}

Combobox seçilen seçilmeyen

string items = string.Empty;foreach (CheckedListBoxItem item in checkedComboBoxEdit1.Properties.GetItems())if (item.CheckState == CheckState.Checked)items += string.Format(“{0} YES \r\n”, item.Description);elseitems += string.Format(“{0} NO \r\n”, item.Description);items = items.TrimEnd(“\r\n”.ToCharArray());XtraMessageBox.Show(items); string items = string.Empty;foreach (CheckedListBoxItem item in chk2015.Properties.GetItems()){if (item.CheckState == CheckState.Checked){// items += string.Format(“{0} YES \r\n”, item.Description);items += item.Description;items += ‘,’;}// işaretli değilse else ile bulunuyor//else// items += string.Format(“{0} NO \r\n”, item.Description);}items…
Devamı

Data table doldurma değe alama

void Oku(){DataTable dt = new DataTable();con = new SqlConnection(@”Server=.\SQL2014;Database=mustafabukulmez;User ID=sa; Password=a123456;pooling=true; “);da = new SqlDataAdapter(“Select * From PERSONEL_TANIMLARI where per_RECno = ” + Okunan_ID + “”, con);ds = new DataSet();con.Open();da.Fill(ds, “Personel”);dt = ds.Tables[“Personel”];con.Close(); txt_per_adi.Text = dt.Rows[0][“per_Adi”].ToString();txt_per_soyad.Text = dt.Rows[0][“per_Soyadi”].ToString();txt_per_TC.Text = dt.Rows[0][“per_TC”].ToString();txt_per_tel.Text = dt.Rows[0][“per_Telefon”].ToString(); }

Dataset içinde arama yapma

private void textBox5_TextChanged(object sender, EventArgs e){DataView dv = ds.Tables[0].DefaultView;dv.RowFilter = “Ad Like ‘”+textBox5.Text+”%’”;//dv.RowFilter = string.Format(“Ad LIKE ‘{0}%’”, textBox5.Text);dataGridView1.DataSource = dv;}

Devexpress radiobox seçilen

string secilen = radioyillar.Properties.Items[radioyillar.SelectedIndex].Description;

Devexpress kontrolleri boşaltma

foreach (Control control in this.Controls[0].Controls){if ((devXtextControl = control as TextEdit) != null){// do something with devXtextControlMessagebox.Show(devXtextControl.Name);}}

Dosya okuma

SqlCommand cmd = new SqlCommand();SqlDataAdapter da = new SqlDataAdapter(cmd);cmd.Connection = Mainform.baglan;