Ceriwis  

Go Back   Ceriwis > HOBI > Komputer & Teknologi > Programming

Programming Share, tanya jawab, saling bantu antar programmer dengan berbagai macam bahasa pemrograman.

Reply
 
Thread Tools
  #1  
Old 20th November 2011
PHPmaster PHPmaster is offline
Ceriwiser
 
Join Date: Nov 2011
Posts: 332
Rep Power: 14
PHPmaster mempunyai hidup yang Normal
Default Help C# + ms.access search function

Jd gini gan..gw lg buat suatu program..trus ada fungsi search nya

nah mslhnya dsni..kata yg dipanggil itu (cth namanya) harus sama persis yang ada di db nya (huruf besar kecilnya jg), jd klu ada nama dr.amatirta trus mo search tirta ga bkal kluar..jd msti ketik lengkap



yg gw mo tanya gmn cara buatnya supaya klu gw search tirta nti bs ditampilin nama yg mngandung kata tirta itu..?

denger2 sih pake Like..tp dah ane coba msh lom jd..



jd tolong ya gan dibantu ,klu ada link tutornya jg oke



trims before



codenya :


Code:

private void btnsearch_Click(object sender, EventArgs e)
{
if (txtsearch.Text == "")
{
MessageBox.Show("Masukkan kata yang ingin dicari", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
txtsearch.Focus();
}
else
{
sqlQRY = "Select * from pegawai Where nama = '" + txtsearch.Text + "'";
cmd.CommandText = sqlQRY;
cmd.Connection = cn;
dr = cmd.ExecuteReader();
dr.Read();

if (dr.HasRows)
{
textBox1.Text = dr[0].ToString();
textBox2.Text = dr[1].ToString();
textBox3.Text = dr[2].ToString();
textBox4.Text = dr[3].ToString();
textBox5.Text = dr[4].ToString();
textBox6.Text = dr[5].ToString();
textBox7.Text = dr[6].ToString();
textBox8.Text = dr[7].ToString();
textBox9.Text = dr[8].ToString();
textBox10.Text = dr[9].ToString();
textBox11.Text = dr[10].ToString();
textBox12.Text = dr[11].ToString();
textBox13.Text = dr[12].ToString();
textBox14.Text = dr[13].ToString();
textBox15.Text = dr[14].ToString();
textBox16.Text = dr[15].ToString();

btnsave.Text = "Update";
btnsave.Enabled = true;
btndelete.Enabled = true;
textBox1.Enabled = true;
textBox2.Enabled = true;
textBox3.Enabled = true;
textBox4.Enabled = true;
textBox5.Enabled = true;
textBox6.Enabled = true;
textBox7.Enabled = true;
textBox8.Enabled = true;
textBox9.Enabled = true;
textBox10.Enabled = true;
textBox11.Enabled = true;
textBox12.Enabled = true;
textBox13.Enabled = true;
textBox14.Enabled = true;
textBox15.Enabled = true;
textBox16.Enabled = true;
}
else
{
btnnew.Enabled = true;
btnsave.Enabled = false;
btndelete.Enabled = false;
clear();


MessageBox.Show("Record tidak ditemukan", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
dr.Close();
dr.Dispose();
}
}



</div>

Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


 


All times are GMT +7. The time now is 10:04 AM.


no new posts