yakup8141 Posted May 9, 2013 Share Posted May 9, 2013 s.a arkadaşlar ben c#da kullanıcı adı ve şifre girişi yapmak istiyormm ama accesden veritabanı ile bağlantılı olacak bazı sitelerde araştırdım ama onlar hatalı cıkıyor yardm edebilirmsnz ?? Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted May 9, 2013 Editor Share Posted May 9, 2013 try { OleDbConnection connect = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\veriler.mdb;"); connect.Open(); OleDbCommand cmd = new OleDbCommand("select * from logonuser where username='"+username.Text+"' and password='"+password.Text+"'", connect); OleDbDataReader read = cmd.ExecuteReader(); while (read.Read()) { if (read["grup"].ToString() == "admin") { user.username = read["username"].ToString(); this.Hide(); Form1 frm = new Form1(); frm.Show(); } else if (read["grup"].ToString() == "user") { this.Hide(); frm.Show(); } else { MessageBox.Show("Böyle bir kullanıcı yok"); } } connect.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } Örnek olarak kendi kullandıgım bir sistemi vereyim sana.Yanlız kendi veritabanına uyarlaman lazım.Çalışmıyor demeyin. Quote Link to comment Share on other sites More sharing options...
yakup8141 Posted May 9, 2013 Author Share Posted May 9, 2013 (edited) try { OleDbConnection connect = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\veriler.mdb;"); connect.Open(); OleDbCommand cmd = new OleDbCommand("select * from logonuser where username='"+username.Text+"' and password='"+password.Text+"'", connect); OleDbDataReader read = cmd.ExecuteReader(); while (read.Read()) { if (read["grup"].ToString() == "admin") { user.username = read["username"].ToString(); this.Hide(); Form1 frm = new Form1(); frm.Show(); } else if (read["grup"].ToString() == "user") { this.Hide(); frm.Show(); } else { MessageBox.Show("Böyle bir kullanıcı yok"); } } connect.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } Örnek olarak kendi kullandıgım bir sistemi vereyim sana.Yanlız kendi veritabanına uyarlaman lazım.Çalışmıyor demeyin. kardesm saolasn bende vardı bi kaç tane ama bi tanesi sadece ilk kullanıcı adını tanıyo diğerlerini tanımıyo bi tanesinde sadce şifreyle giriyo filan öyle bi sorun yok deil mi? Edited May 9, 2013 by yakup8141 Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted May 9, 2013 Editor Share Posted May 9, 2013 Tabiki kullanıcı adı ve şifreyi kontrol eder bu. Quote Link to comment Share on other sites More sharing options...
yakup8141 Posted May 9, 2013 Author Share Posted May 9, 2013 Tabiki kullanıcı adı ve şifreyi kontrol eder bu. eyw kardsm saolsn :D Quote Link to comment Share on other sites More sharing options...
yakup8141 Posted May 15, 2013 Author Share Posted May 15, 2013 try { OleDbConnection connect = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\veriler.mdb;"); connect.Open(); OleDbCommand cmd = new OleDbCommand("select * from logonuser where username='"+username.Text+"' and password='"+password.Text+"'", connect); OleDbDataReader read = cmd.ExecuteReader(); while (read.Read()) { if (read["grup"].ToString() == "admin") { user.username = read["username"].ToString(); this.Hide(); Form1 frm = new Form1(); frm.Show(); } else if (read["grup"].ToString() == "user") { this.Hide(); frm.Show(); } else { MessageBox.Show("Böyle bir kullanıcı yok"); } } connect.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } Örnek olarak kendi kullandıgım bir sistemi vereyim sana.Yanlız kendi veritabanına uyarlaman lazım.Çalışmıyor demeyin. kardesm ben burada kendi veritabanıma uyarlamaya çalıstımda anlayamadığm bir 2 nokta var aydınlatır msn ? :D 1--> "grup" nedir nerde kullandın ? 2-->"user.username = read["username"].ToString();" user ve username değişkenleri nerden geliyo ? 3--> if (read["grup"].ToString() == "admin") { user.username = read["username"].ToString(); this.Hide(); Form1 frm = new Form1(); frm.Show(); } else if (read["grup"].ToString() == "user") { this.Hide(); frm.Show(); } buranın mantığını açıklar msn son olarak read grup== use ve read grup== admin demişşsn ne oluyo bunlarda ? nası bi karsılastırma yapıyo ? Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted May 15, 2013 Editor Share Posted May 15, 2013 Neden alıntı yaptın orayı anlayamadım. Quote Link to comment Share on other sites More sharing options...
yakup8141 Posted May 15, 2013 Author Share Posted May 15, 2013 Neden alıntı yaptın orayı anlayamadım. alıntı derken ? aynısını neden aldın anlamında mi ? senin verdiğin kodlar deil mi bunlar ? Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted May 15, 2013 Editor Share Posted May 15, 2013 Benim verdiğim kodlar Quote Link to comment Share on other sites More sharing options...
yakup8141 Posted May 15, 2013 Author Share Posted May 15, 2013 Benim verdiğim kodlar alıntı derken neyi kasteddn peki ? Quote Link to comment Share on other sites More sharing options...
yakup8141 Posted May 15, 2013 Author Share Posted May 15, 2013 Benim verdiğim kodlar SORULARIMA CEVAP VERMİCEKMİSN ? KARDESS ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.