Laman

Minggu, 06 Februari 2011

membuat form login dengan database Mysql di C# ( C Sharp )

Pada tutorial kali ini akan dibuat suatu project untuk login, dimana data user dan passwordnya di simpan disuatu DBMS, dan disini DBMS yang digunakan adalah MYSQL. untuk langkah langkah pembuatannya silahkan perhatikan dibawah ini. sebelumnya siapkan terlebih dahulu project kosong, klik file new project, setelah muncul kotak dialog baru, ketik nama project pada kotak project name, klik OK. Untuk selanjutnya silahkan ikuti instruksi-instruksi dibawah ini. sebelumnya silahkan baca artikel bagaimana cara mengkoneksikan antara C# dengan DBMS mysql disini karena ini akan sangat membantu dalam memahi materi ini
langkah 1 : Tambahkan satu komponen picture box, empat label, dua button dan dua textbox, atur dan tata sedemikian rupa sehingga tampilannya seperti pada gambar dibawah.
langkah 2 : klik ganda pada button satu untuk membangkitkan event klik pada button tersebut, tambahkan code berikut ini pada event klik tersebut



langkah 3 : tambahkan function status login(string user, string password), berikut ini source lengkapnya
 

source code diatas merupakan code untuk melakukan koneksi antara C# dengan DBMS mysql, untuk cara detail bagaimana mengkonkesikan antara C# dengan mysql silahkan baca artikel disini
Langkah 4 : Buat database di mysq dengan isi filed ID,USER,PASSWORD. dan isikan data di database tersebut, nama database dan nama table dalam database adalah "formlogin"
langkah 5 : Done. program selesai dibuat


Jika langkah langkah diatas dilakukan dengan benar, maka saat program dijankan program akan menampilakan suatu form seperti pada gambar diatas, masukan password dan user sesuai dengan data yang ada didatabase, jika data password dan data user benar. akan muncul suatu form yang menunjukan bahwa login berhasil. jika data password dan data user salah, maka akan muncul pesan bahwa user dan password salah. dan jangan lupa, sewaktu menjalankan program service mysql harus berjalan. berikut preview hasil program yang sudah selesai


Gambar 1. Preview ketika program dijalankan


Gambar 2. Preview ketika program dijalankan

Untuk download full project dan lebih memahami materi ini, silahkan perhatikan video tutorial membuat form sederhana dibawah ini,
Link download ada di bagian paling akhir dari video.


pandauan download : Silahkan buka Link Download yang berada di akhir video diatas, setelah itu akan muncul halaman adf.ly, tunggu beberapa detik sampai pada pojok kanan atas muncul tulisan skip ad. klik tombol tersebut untuk full download project.

26 komentar:

  1. Ane coba modif dikit biar akses database online, kok dapet error ya?

    Host '125.161.***.***' is not allowed to connect to this MySQL server


    Apa ditolak sama database hosting ya?

    BalasHapus
  2. iya benar sekali.. program tidak mendapatkan izin akses ke DBMS online. ingat untuk akses ke DBMS ada user dan passwordnya. jika kita menggunakan DBMS MYSQL versi offline secara default user nya adalah root dan passwordnya kosong, sehingga koneksi string di program seperti ini

    string connectionSQL = "server=localhost;database=tugaspbdw;uid=root;password=;";

    perhatikan bahwasanya password="". yang artinya DBMS yang kita gunakan dalam kasus ini tidak diprotek dengan password. Jika saudara mengkoneksikan dengan versi ONLINE pastikan user dan password yang anda masukan benar.

    SEMOGA BISA MEMBANTU.......

    BalasHapus
  3. waktu saya ikutin programnya ada error kakak... pesannya Error 1 'Coba.FormCoba.trytologin(string, string)': not all code paths return a value

    BalasHapus
  4. jika pesan error seperti trytologin(string, string)': not all code paths return a value ini berarti function trytologin(string,string) belum di return values.

    ingat... pada C# function yang sudah di deklarasikan harus mempunyai nilai balik (return value) sesuai dengan type data dari function yang telah di deklarasikan sebelumnya.

    BalasHapus
  5. permisi nih, mau nnya..
    saya udah buat progaram sepintas ada mirip ny kaya ini..
    ngecek data didalaem database..
    klo data ny ga ada tapi koq hasil ny ga kluar aja yah..
    padahal saya udah pasang "messagebox" klo didalem database ngga ada datany..

    klo bingung, ini saya kasih link ke forum kaskus tempat saya bikin trit ny..
    http://www.kaskus.us/showthread.php?p=510914337#post510914337

    mohon bantuan ny, makasih.. :)

    BalasHapus
  6. untuk saudara wili.
    Progra saudara sepertinya rumayan kompleks, banyak hal dasar yang harus dipelajari mendalam, tapi sepintas dari penjelasan saudara, inti permasalahannya bukan pada koneksi dengan DBMS MYSQLnya akan tetepi pada pengolahan string inputan, saya sarankan saudara menggunakan REGEX, dengan REGEX akan lebih mudah dalam mengelola string,

    BalasHapus
  7. Boim_funkzore19 Maret 2012 20.20

    untuk yang langkah 3 di tulis di class baru atau dimna ??mohon bantuanya,,,

    BalasHapus
  8. csharp-indonesia.com20 Maret 2012 13.50

    untuk langkah ketiga source code function tersebut tetap ditulis di form pertama,
    silahkan mencoba semoga berhasil

    BalasHapus
  9. Imam Moeslim31 Mei 2012 22.50

    maksud nya FIELD ID,USER <== ?

    BalasHapus
  10. Imam Moeslim31 Mei 2012 22.50

    kenapa ga USER dan PASSWORD saja? (untuk di database)

    yang saya tanyakan. penggunaan ID nya itu untuk apa? :)

    BalasHapus
  11. Imam Moeslim2 Juni 2012 09.50

    THX banget gan... WORKS .... tp ane agak modifikasi sedikit ... :)

    BalasHapus
  12. BelajarCsharp5 Juni 2012 20.39

    Oke, terimakasih, semoga bisa membantu dan bermanfaat

    BalasHapus
  13. BelajarCsharp5 Juni 2012 20.40

    untuk ID itu merujuk ke konsep database, dimana disetiap table diharuskan mempunyai sebuat attibute yang unik atau disebut dengan Primary Key dan disini posisi ID adalah sebagai primary Key

    BalasHapus
  14. bagaimana gan kalau masukin user dan passwordnya melalui serial port?

    BalasHapus
  15. gan bagaimana kalo menggunakan session.. apakah bisa atau tdk..tq

    BalasHapus
  16. makasih mass infonya..
    info seputar bola, prediksi bola ter-update..
    berita bola TERBARU DAN TERPERCAYA hanya ada di www.bola368.net
    Kunjungi juga www.bola368.org, Anda puas Kami pun senang.!

    BalasHapus
  17. gan kalo pake excel gimana???

    BalasHapus
  18. They even feature a delicate yet adorable metal “O” icon on each side for a stylish and standout contrast. The Polarized LBD sunnies come with top-performing HDPolarized lenses which minimize glare and filter out 100% of all harmful UVA, UVB, and UVC rays, letting you conquer the sun with style. The LBD’s can be dressed up with oakley vault a gorgeous printed dress and sandals or dressed down with an easy, breezy top and cutoff shorts while lounging beachside—and you can even count on the LBD’s to keep you shielded as you sweat in style while enjoying an outdoor run. No matter how what you’ve got planned for summer, one thing lies for oakley womens sunglasses certain, you can rely on Oakley’s LBD’s to be your summer staple to feel stylish and sexy while on the move.
    That’s creative marketing and publicity at its finest.Greene poses in a variety of photos for the campaign. She’s seen performing her favorite workouts. In one photo, she performs some planks. In another photo, fake oakleys cheap shipping she looks like she’s getting ready for a run.Greene also poses in various workout gear. She can be seen everything from an aqua blue camisole and purple leggings to a purple sports. She’s not without her Oakley sunglasses either.Greene said in a recent statement that fitness is an important part of her life. She discount oakley sunglasses admits that she loves to feel strong. Greene is glad to be a part of Oakley’s campaign because she wants to encourage others to life a healthy and active lifestyle.Ashley Green revealed to People that she tries to stay active by walking her dogs or taking hikes every day. It looks like this “Twilight” oakley star will bring some fitness inspiration to her young fans.
    Melbourne, FL (December 13, 2014) ? This is the time of the year when companies have their employees select their health, dental and vision benefits for the up and coming new year. All the companies I have worked for and the school district sunglass hut I now work for have a vision plan. Visions plans, depending what level the employee chooses will give the employee one examination every two years and a pair of free glasses. This year I chose the high end plan that reduced the plan from every two years to every year. I am really excited oakley outlet about the yearly plan because it allows me and my wife more options when selecting frames and lenses.Before I started wearing Rx sunglasses, I was wearing Guideline Eclipse sunglasses. I like them so much that I decided to give the Guideline RX a chance and I have not been disappointed.Early this year, both my http://www.warbyparkersunglasshut.com wife and I started wearing Guideline Rx sunglasses and we both just love the overall quality of these sunglasses

    BalasHapus
  19. “It says, ‘I’m not Ray-Ban, I’m Blakened,” says Hinton.24DP, an award winning Greenwich Village-based production company ray ban sunglasses sale and creative group, formally announced its expansion into a full service advertising agency today. The firm’s new addition to its business model will provide advertisers with a welcomed alternative to large and costly agencies that are synonymous with Madison Avenue.In a press statement, CEO Brian Cristiano, a sunglass hut 2008 New York Emmy? award winner [Advanced Media: Commercial] acknowledges “it is a fact that large advertising agencies have massive overhead and that their clients pay for it directly.” These high operational costs are directly correlated to their reliance upon third party vendors for production and creative ## services. As 24DP will now function as an all-in-one advertising, creative and production house, clients will doubtlessly benefit from its streamlined and very cost effective services; all campaign elements – from conceptualization to execution, and everything in between – will be handled in-house, saving businesses time ray ban aviators and money, while maximizing ROI and leveragability.
    Take a look at some of the pictures from my Coachella adventures, including the obligatory In-n-Out stop, the bags I brought and the infamous Coachella Ferris Wheel (if you ever get a chance to ride, DO IT!). Having the Twilight ray ban glasses cast sport your product is certainly no hindrance to forward progress in marketing.At least, that's been the case with a few of those companies whose goods have been featured in the Twilight series or upon its cast.With Volvo, for instance, we've seen that the vehicle models appearing discount ray ban sunglasses in Twilight and The Twilight Saga: New Moon enjoyed subsequent sales boosts which the company attributed to inclusion in the picture.The same, it seems, is true for Ray-Bans.According to a recent press release, Ray-Ban is reporting record sales for this year, and they have the Twilight films ray ban sunglasses and cast to thank for it."Ray-Ban sunglasses have long been a favorite of celebrities, and are seeing a resurgence in the younger generation, most recently amongst the stars of the ‘Twilight’ films, who have been seen wearing Ray-Ban Wayfarers in the movies and in real life."
    While ray ban clubmaster classic black Wayfarers will never go out of style, Ray Ban also currently offers a contemporary color palette allowing you to display your own style and personality. And you can even go crazy and express yourself ray ban clubmasters with the latest addition to Ray-Ban Wayfarer sunglasses in the limited edition Rare Prints. These funky prints are inspired by themes that represent the essence of Ray-Ban’s history and style. While these Ray Bans are perfect for a day at the beach, they are yet chic enough to be paired with the most cosmopolitan of ensembles.

    BalasHapus
  20. Today, Electric Daisy is a weeklong event that includes celebrity DJ parties at resorts such as the Wynn Las Vegas and a two-day conference on the dance music business at the Cosmopolitan of Las Vegas, owned by the Blackstone Group. “Now they put us on their marquees,” Rotella says of the casinos.A number of Ray Ban Wayfarer blue chip investors and advertisers are backing the Rock in Rio festival, which held its first event in Brazil 30 years ago. SFX Entertainment, which co-owns the festival globally, is staging the $75 million event alongside local partners Cirque du Soleil and Ron Burkle, the billionaire Los Angeles investor. Rock in Rio has sold almost $15 million in sponsorships Oakley Eyeglasses to 63 companies including Mercedes-Benz, Corona beer, and Chilli Beans sunglasses.
    "He said, 'I needle you guys out of affection,'" Wallsten said. "I said, 'I understand that, but I don't want you to treat me any differently because of this."'Wallsten said the president said he would not treat him differently, so Wallsten encouraged him to "needle away.""He said, 'I Cheap Oakley Sunglasses will. Next time I'll just use a different needle,'" Wallsten said.Wallsten said he thought that was a pretty good line. And his only complaint is that the president didn't answer his question at the news conference.Wallsten, who is also author of a book coming out next month titled "One Party Country: The Republican Plan for Dominance in the 21st Ray-Ban Sunglasses Century," had asked about White House credibility now in the aftermath of top aide Karl Rove having been cleared in the CIA leak investigation. But Mr. Bush said he wouldn't comment with another top White House aide still facing prosecution in the case. Sunglasses are the must-have accessory for summer. But with so many shapes and styles to choose Oakley Outlet from, it's sometimes hard to determine what's right for you. Never fear, "Early Show" Style Contributor Katrina Szish has the perfect sunglasses for everyone. Szish says it is important to first determine your face shape to steer yourself towards a trend that works for you. NEW YORK -- Before you plunk down $500 for a pair of prescription eyeglasses, oakley polarized you might consider getting them online.
    “People are starting to look at sunglasses differently, as a more premium accessory,” says Hansen, whose stores offer visitors complimentary drinks and chocolates while they shop.That’s why it’s important to find a pair that suits your face shape. The size of your sunglasses should be proportional to your face size. It’s important to Ray-Ban look for frames that complement a face by softening or drawing attention away from its more prominent features. Lozac’h, for example, needed a frame that would widen his long face. Don’t look for larger frames if you have a small face and vice versa. Oval-shaped faces are symmetrical, so most styles will work. These lucky few can experiment with oakley batwolf different shapes, styles and colors.
    "UV protection is very, very important. It's like you wouldn't go to the beach without putting sunblock on your body," said Dr.

    BalasHapus
  21. Moncler, an Italian company known for sporty, shiny down coats, posted a 60 percent jump in revenue from 2011 to 2013. In the first nine months of this year, its sales climbed another 18 percent. Moncler has been a staple in canada goose jakke Swiss ski lodges and the rest of the world’s snowy playgrounds for more than six decades. But it wasn’t until 2006 that the company introduced a haute couture line for women, and a high-fashion men’s line followed three years later. In the past year, Moncler has opened stores in dozens of conspicuously temperate places as part of a push to get its products into urban environments. It’s betting its future on Hawaii—where a Moncler store is already open for business—instead of the Himalayas.
    Reiss also found cheap ways to market canada goose outlet online the brand. He gave coats to bouncers at Toronto nightclubs and scalpers outside the city’s sports arenas. Canada Goose parkas were already popular with movie crews, and he capitalized on that. The company is a sponsor of the Toronto, Sundance, Berlin, and Busan film festivals. Producer Rose Ganguzza remembers calling up the coatmaker in February 2011 when she was making Kill Your Darlings, a drama about the coming-of-age of the Beats and a sensational 1944 murder. “We were going to be shooting scenes on the Hudson River in 20-below temperatures,” doudoune canada goose Ganguzza says, with perhaps a touch of exaggeration. Canada Goose outfitted the entire cast and crew for free. “They found loyal customers in every one of those people,” she says. “Dan Radcliffe”—the English actor plays a young Allen Ginsberg in the film—“every year wants a new Canada Goose jacket.”In late 2012, Sports Illustrated got in touch with the company to outfit a crew going to Antarctica to shoot the 2013 swimsuit issue. The supermodel Kate Upton ended up wearing one of the coats, a white Chilliwack bomber jacket, on the http://www.canadagoosejacketsoutletonlinesale.com cover of the magazine, her face haloed in coyote fur. In 2013, Canada Goose’s U.S. sales increased 25 percent; last year, they rose an additional 30 percent. Reiss expects sales to grow by half in 2015.
    But is that sufficient reason to make it Canada's national symbol?Historical significance aside, the beaver is a destructive animal, indiscriminately gnawing down trees, without a thought as to where they fall. Beaver dams block rivers and streams which can be harmless, but also can alter the landscape and cause flooding of arable lands.Nor is winter jackets canada the beaver handsome, with an admirable personality. The polar bear, of course, is alarmingly handsome and resolute -- the world's largest land carnivore you don't want to mess with.My choice for a national symbol 30 years ago -- and remains so today -- is the Canada Goose. Critics fret that Canada Geese are a nuisance in parks,

    BalasHapus
  22. Although her U.S. business is markedly smaller — sales amount to $30 million, according to the same source — the handbag line is expected to generate $10 million to $12 million at retail in its first year in the U.S., according to industry estimates.Stuart has always incorporated accessories into her rtw line, but the Schifter union will coach bags result in the designer’s first comprehensive handbag and small leather goods collection to be distributed internationally.
    Next year marks Coach’s 75th anniversary.“How long has Coach been around?” queried Diane von Furstenberg Tuesday night when she hosted a dinner for the brand’s president and executive creative coach outlet stores director Reed Krakoff. “One hundred years, hundreds of years?” Sixty-six as it turns out, only 10 of which have had Krakoff at the design helm. But to that the Council of Fashion Designers of America’s president paid no mind. “For me, there was no Coach coach outlet online before Reed,” she said with affection.
    Sebring commented on the “energy” of Beijing but admitted he was put off by the air pollution. When he landed at the airport, he asked a woman accompanying him, “What is that smell?”The dinner, created by chef and Paltrow coach online friend Mario Batali — who was not in Beijing — included fried zucchini blossoms, butternut squash tortellini, short ribs in barolo, and a ricotta pudding cake.“I’ve always had a great passion for brands,” declared Coach’s Stuart Vevers to begin his presentation. A mere glance at coach factory outlet the designer’s résumé would confirm that statement; over the past 19 years, Vevers has designed for the likes of Bottega Veneta, Givenchy, Mulberry, Louis Vuitton, Loewe and, now, Coach, where Vevers has served as executive creative director since June 2013.
    WIN A DATE WITH BILL coach store CLINTON: Recently recovered from a bout of the flu and an E.coli bacteria infection, Sir Elton John on Monday night hosted former President Bill Clinton, Mayor Michael Bloomberg, Sharon Stone, Daniel Craig, Lily Safra and Evelyn and Leonard Lauder, among others, at the eighth annual www.coachfactory.com/store benefit for the Elton John AIDS Foundation. Clinton was honored and captivated the black-tie clad crowd at Cipriani Wall Street as he spoke about the work that needs to be done, particularly in developing countries, to fight HIV/AIDS. As the 42nd president accepted his award, coach factory he also teased John, “That’s a really beautiful award.

    BalasHapus