Create Login Window in C# Using Sql Server

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ธ.ค. 2024

ความคิดเห็น •

  • @CodAffection
    @CodAffection  8 ปีที่แล้ว +3

    goo.gl/RFY5C2 : Subscribe to CodAffection
    goo.gl/Z6SkSC : C# CRUD Operations With DB
    goo.gl/WsgPbp : C# User Registration With DB
    goo.gl/Gu5q37 : Export PDF in C#

  • @rjcreations6727
    @rjcreations6727 4 ปีที่แล้ว +1

    I am beginner to C#. Search many places. But your explained the working method step by step. Thanks a lot.

  • @Error-vd1yo
    @Error-vd1yo 4 ปีที่แล้ว +3

    please help I am at 17:50, and I get this error no matter what
    System.Data.SqlClient.SqlException: 'Incorrect syntax near the keyword 'Table'.'

  • @ichbindummwaasduauch6358
    @ichbindummwaasduauch6358 7 ปีที่แล้ว +3

    Can you help me? At the saving 8:45 if I click OK at save in into DB it doesnt show in server explorer at tables

    • @nottokyo1401
      @nottokyo1401 3 ปีที่แล้ว +2

      In stead of saving the file, click the UPDATE button in the top left cornor of the window, then you'll get a window where you can click execute query, your table will be added to your database ;)

  • @OwlYaRlyRUS
    @OwlYaRlyRUS 6 ปีที่แล้ว +1

    Hi, I have a question. In video, you have one main form. But if I have two, and for each form I have login and password, how I can realize this?
    9:10 - I see, you create here 2 users, but you didn't use 2nd user in code. I try did it - I remade part of code "if(dtbl.Rows.Count == 1)", where I changed 1 to 2 and changed text in braces for my 2nd form and this reworked part I inserted after "else {...}". But when I run the application and enter the data for the second user, Visual Studio opens for some reason the first form. What should I do?

  • @connief2679
    @connief2679 3 ปีที่แล้ว +6

    OMG! You saved me! Thought I was going to be up all night again trying to finish my project, but this video was SOOO helpful! Thank you, thank you, thank you.

  • @SMart-iy7zx
    @SMart-iy7zx 4 ปีที่แล้ว

    even after 4 years it`s a best video. thx man

  • @TarunKumar-ry7bc
    @TarunKumar-ry7bc 2 ปีที่แล้ว

    Thanks man i have windows app interview today thanks a lot

  • @madmac558
    @madmac558 4 ปีที่แล้ว +4

    Tried this for a project i am building, very helpful Thank you. You should upload some recent videos like this of Visual Studio 2019

  • @warzhydra990
    @warzhydra990 6 ปีที่แล้ว +6

    This helped me a lot😊thank youw❤

  • @ronaldjohnson4470
    @ronaldjohnson4470 6 ปีที่แล้ว +12

    Great tutorial, Thank you.

  • @bagup_alpharetards
    @bagup_alpharetards 5 ปีที่แล้ว

    At 8:40 when i press ctl+s instead of showing a dialoge box that shows in the video like choose name,
    my PC asks to saves the file in my documents or in local disk drive instead of saving it in visual studio like a dialoge box has appeared for the name of the table. Please can someone help. Please.

    • @CyberKittenlol
      @CyberKittenlol 5 ปีที่แล้ว

      I think i have the same problem too. I first save a place where in your drive then in the upper-left corner of the Table Designer, select the Update button.
      Then you save it I think(because im trying

  • @jmdeluxe
    @jmdeluxe 4 ปีที่แล้ว +2

    System.Data.SqlClient.SqlException (0x80131904): An attempt to attach an auto-named database for file C: \Users\jmpla\source
    epos\Aqua Lab\DataBase\LoginDB.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share. HELPPP

  • @ПавелК-й1ж
    @ПавелК-й1ж 5 ปีที่แล้ว +2

    Crystal clear! Thanks a lot.

  • @earnafterlearn9765
    @earnafterlearn9765 7 ปีที่แล้ว

    Best tutorial so far for login authentication..

    • @CodAffection
      @CodAffection  7 ปีที่แล้ว

      I am glad you found the video helpful.

  • @zafersogutcu
    @zafersogutcu 8 ปีที่แล้ว

    Thank you very much, it worked perfectly!

  • @georgevetolavman
    @georgevetolavman 6 ปีที่แล้ว +2

    Thank you sir! Very good tutorial.

  • @farahsghaier9891
    @farahsghaier9891 4 ปีที่แล้ว +2

    Thanks for this tutorial , but I have a problem with the sda.Fill(dtbl).
    ==> System.Data.SqlClient.SqlException: 'An expression of non-boolean type specified in a context where a condition is expected, near 'de'.'
    I have already read the comments and i didn't find the right answer .
    Please answer me as soon as possible.

    • @Killermonktr
      @Killermonktr 2 ปีที่แล้ว

      im stuck there aswell, hope u found an answer after a year xD

  • @PatrosAnime
    @PatrosAnime หลายเดือนก่อน

    7:58 when i clicked new table an error occured called : "An incompatible SQL server version was detected "
    What should i do man?

    • @CodAffection
      @CodAffection  หลายเดือนก่อน

      Have you tried this : stackoverflow.com/a/27881800/4133590

  • @justjase10
    @justjase10 2 ปีที่แล้ว

    Thanks for the help, it worked🎉

  • @MajidAliRN
    @MajidAliRN 5 ปีที่แล้ว +1

    Those having issue with sda.Fill(dt);
    please, check your sda query, the username and password we are using from input in the query should have apostrophes " ' " enclosing them. please, check the code carefully and make sure you add those, and your problem will be solved.

    • @CodAffection
      @CodAffection  5 ปีที่แล้ว +1

      thanks for the info . hope you found this C# tutorial helpful.

    • @MajidAliRN
      @MajidAliRN 5 ปีที่แล้ว

      @@CodAffection yes sir, your turorial has helped me a lot. Thank you so much !

  • @Cossack3000
    @Cossack3000 6 ปีที่แล้ว +7

    Crystal clear. Thanks for the explanation, it really helped!

  • @kasyfredy
    @kasyfredy 8 ปีที่แล้ว +1

    Your are the Best mate! straightforward and easy to follow the steps, Thanks...

    • @CodAffection
      @CodAffection  8 ปีที่แล้ว

      you are welcome, by the way thanks for watching my video

  • @yasmine2176
    @yasmine2176 2 ปีที่แล้ว

    thankyou you just saved my life

  • @vega7836
    @vega7836 5 ปีที่แล้ว

    Thank you very much! My software buyers can now safely use their purchased program!

    • @CodAffection
      @CodAffection  5 ปีที่แล้ว

      glad you found the video helpful in your live projects.

    • @digitplays4008
      @digitplays4008 5 ปีที่แล้ว +2

      What a load lol, if anyone was buying software it wouldnt be from someone who couldnt make a login form.

  • @YamiKeizerLeon
    @YamiKeizerLeon 7 ปีที่แล้ว

    Thanks! Its working :D

  • @sameeraprasantha4586
    @sameeraprasantha4586 2 ปีที่แล้ว +1

    Thank you.!

  • @WayEngineer
    @WayEngineer 5 ปีที่แล้ว +1

    Super gooooood!!! Thank you!)))

  • @helengargantiel4065
    @helengargantiel4065 2 ปีที่แล้ว +1

    thank you so much! ❤

  • @truebittech
    @truebittech 4 ปีที่แล้ว +1

    I cant debug it shows 1)The name 'txtusername' does not exist in the current context
    2)The name 'txtpassword' does not exist in the current context
    Plz help what I do

  • @harikrishnants8545
    @harikrishnants8545 4 ปีที่แล้ว +1

    I"m using Visual studio 2019. I cannot create tables with the steps provided by you. In the Server Explorer under the table it shows nothing.

    • @hackslash834
      @hackslash834 4 ปีที่แล้ว +2

      Don't know if you figured it out or not but I will leave this here for anyone with the same problem. There is an update button at the top of the table you can click on. It will then save it on the existing mdf file. Under the table there is a sql query on that you can edit your table. Make changes here. To see the change or whether your table is created or not you have to rightclick the table folder on the database connection and refresh.

    • @karthiknayak5632
      @karthiknayak5632 4 ปีที่แล้ว +1

      @@hackslash834 ya i fixed the issue thanks for the comment.

    • @CodAffection
      @CodAffection  4 ปีที่แล้ว +1

      thanks for sharing your thoughts.

  • @sheivongamboa
    @sheivongamboa 4 ปีที่แล้ว +1

    Use secure procedure is better than leaving open SQL query string

  • @kotoriitsuka1097
    @kotoriitsuka1097 7 ปีที่แล้ว +1

    8:36 could you explain what do you say there?

    • @CodAffection
      @CodAffection  7 ปีที่แล้ว

      Showing how to save the table
      Press Ctrl + S to Save the Table. it will open a dialog box, Name your table inside the dialog box, then click OK.
      Then added sample record into the table.

    • @kotoriitsuka1097
      @kotoriitsuka1097 7 ปีที่แล้ว +1

      Thank you for fast answer. I appreciate all work that you put into your videos. It is very helpful. Thank you! :)

  • @devmanav6808
    @devmanav6808 7 ปีที่แล้ว +1

    Thanks Lot very helpful keep it up !!!

  • @chaitu_ash7600
    @chaitu_ash7600 5 ปีที่แล้ว +1

    Thank you for good subject guven for me....i have an doubt I. E., u r creating one table that is login table in database right, in that table first username value is 1 only....y u giving user1 as in username value in login form? 1 and user1 both r same in this situation? Please clarify my doubt as soon as possible. I'm waiting for ur response. Tq

    • @CodAffection
      @CodAffection  5 ปีที่แล้ว

      sorry, I didn't get you.

  • @spikeisback
    @spikeisback 7 ปีที่แล้ว

    System.Data.SqlClient.SqlException: 'An attempt to attach an auto-named database for file C: \Users\sam\Desktop\Passwords And user.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.'

    • @CodAffection
      @CodAffection  7 ปีที่แล้ว

      try this stackoverflow.com/a/14779107/4133590

  • @g3nito409
    @g3nito409 5 ปีที่แล้ว +1

    Bro much love for you you helped me a lot i loveyou so much have a great life

    • @CodAffection
      @CodAffection  5 ปีที่แล้ว +1

      thanks for the wonderful comment.

  • @lehlohonolomotloung1167
    @lehlohonolomotloung1167 5 ปีที่แล้ว

    This was pretty helpful. Thanks a mill

  • @Ivan-tb1cw
    @Ivan-tb1cw 7 ปีที่แล้ว +3

    bakit kapag pinipindot ko yung login ganto nalabas?
    An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll
    Additional information: An attempt to attach an auto-named database for file C: \Users\Mercado\Documents\Visual Studio 2015\Projects\GenericoCashieringSystem\GenericoCashieringSystem\LoginDB.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

  • @Scaramouche122
    @Scaramouche122 3 ปีที่แล้ว

    *YOU ARE THE BEST!!!*

  • @IamRamishka
    @IamRamishka 4 ปีที่แล้ว +1

    Thank You Sir....!!!!

  • @mpumelelosicelomthethwa4635
    @mpumelelosicelomthethwa4635 6 ปีที่แล้ว

    Thanks alot man, very useful!!

  • @leedenbigh
    @leedenbigh 6 ปีที่แล้ว +2

    Thank you very much for this.

  • @simobl8277
    @simobl8277 4 ปีที่แล้ว +1

    this helped me thank you bro

  • @KiKus121
    @KiKus121 ปีที่แล้ว

    I love u man, thank u :)

  • @lucasbraga8569
    @lucasbraga8569 6 ปีที่แล้ว

    You helped me a lot. Thank you!

  • @乔治高老庄
    @乔治高老庄 3 ปีที่แล้ว

    query one record then direct to main form to open but not to match successfully with bool true.

  • @Oom_Sakkie
    @Oom_Sakkie 3 ปีที่แล้ว

    god bless you and your voice

  • @gaborkosa263
    @gaborkosa263 3 ปีที่แล้ว

    sir! thank you!its works fine!

  • @rohithiwale3750
    @rohithiwale3750 8 ปีที่แล้ว

    Thank you For helping Others!!!!!!

  • @jesvirsubang6725
    @jesvirsubang6725 5 ปีที่แล้ว +3

    how can i display the name of the user who logged in to the next form?

    • @jeremychu8922
      @jeremychu8922 5 ปีที่แล้ว

      you need the database varible and in textlabel script
      label.text = "varible"

  • @daniealasyraf9129
    @daniealasyraf9129 7 ปีที่แล้ว

    Why this error occur at 'sda.Fill(dtbl)'?
    Exception unhandled
    System.Data.SqlClient.SqlException: 'An attempt to attach an auto-named database for file C: \Users\User\Documents\Visual Studio 2017\Projects\LoginApp\DB\LoginDB.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.'

    • @CodAffection
      @CodAffection  7 ปีที่แล้ว

      did you download the source code ?

    • @daniealasyraf9129
      @daniealasyraf9129 7 ปีที่แล้ว

      Yes... can you teach me how to enter RC4 encryption for the password?

  • @techsics5456
    @techsics5456 3 ปีที่แล้ว

    Thanks a lot❤️❤️❤️❤️

  • @n3odemencial30
    @n3odemencial30 3 ปีที่แล้ว

    The name 'ObjFrmMain' not exist at the current context. could you help me please?

  • @JulianPrithiviraj
    @JulianPrithiviraj ปีที่แล้ว

    very useful thanks a lot

  • @justinromaine3493
    @justinromaine3493 7 ปีที่แล้ว

    How to make it to connect to a website Sql data have I replaced the like url for the database with the remote database but when I hit start it will stop saying like it can't connect but it's connected in visual studio.

    • @CodAffection
      @CodAffection  7 ปีที่แล้ว

      you want to connect Live SQL Server Database ?

  • @RadhaKrishna_777
    @RadhaKrishna_777 4 ปีที่แล้ว

    😍😇 thnk U sO mUch sir !!

  • @MuhammadHammad-jj8pe
    @MuhammadHammad-jj8pe 4 ปีที่แล้ว

    Iam using vs 2017 but when i ctrl + s to name the table it doesnt open any dialog box and takes me to save it and not showing it in tables ?
    Can you help me out

    • @bunyipimaboy5715
      @bunyipimaboy5715 4 ปีที่แล้ว

      same thing happens to me

    • @lovehunter8278
      @lovehunter8278 4 ปีที่แล้ว

      You may try to save it under the db location and refresh table

  • @gizachewadane6262
    @gizachewadane6262 6 ปีที่แล้ว +1

    Thank you it has Great tutorial

  • @jaydipgadhiya2265
    @jaydipgadhiya2265 4 ปีที่แล้ว +1

    Server Explore in Data Connections in LoginDB in Table in File do not show.
    Please sir Help me

  • @thqdaska
    @thqdaska 4 ปีที่แล้ว

    When I add table n databse it doesnot appear in table option.

  • @kshitijbali6915
    @kshitijbali6915 4 ปีที่แล้ว

    I wrote my code exactly like this, only my table name is /*Signup*/. Upon running the application even after entering correct username and password it is saying check username and password. Please help

  • @Rebelvlog07
    @Rebelvlog07 6 ปีที่แล้ว +1

    nice uploade more video related windows form

  • @user-tf7te5fs2n
    @user-tf7te5fs2n 3 ปีที่แล้ว

    How to create it for multi user so every one has different form apperead after logging in??

  • @johnkarippery9919
    @johnkarippery9919 4 ปีที่แล้ว

    is that possible when i click login it navigate to my google account?

  • @Vapsiz
    @Vapsiz 7 ปีที่แล้ว

    when I hit add a table it just says loading... the design surface is loading.. it's been 27 minutes ffs

  • @renzguinto125
    @renzguinto125 7 ปีที่แล้ว

    A network related or instance specific error occured while establishing a connection to sql server. the server was no found or was not accessible. verify that the instance name is correct and that sql server is configured to allow remote connections. proivder sql network interfaces, error 26 error locating server/. instance specified
    I'm getting this problem in adding connection can you help me?

    • @CodAffection
      @CodAffection  7 ปีที่แล้ว

      please SQL server connection string.

    • @renzguinto125
      @renzguinto125 7 ปีที่แล้ว

      Already fix this thank you i just downloaded the sql server

    • @renzguinto125
      @renzguinto125 7 ปีที่แล้ว

      can you help me i want to make my button to add number on text box example if i click the button there will be value in text box
      EXAMPLE: clicked the button textbox value = 1
      clicked the button for the second time the value of textbox 1 will be 2 and so on

    • @CodAffection
      @CodAffection  7 ปีที่แล้ว

      If Textbox = txt , Button = btn, (Control Naming)
      txt.Text =(Convert.ToInt32(txt .Text)+ 1).ToString();

  • @localbus7008
    @localbus7008 4 ปีที่แล้ว

    Dear I got error ' invalid object name ' ? Please help me..

  • @softarn5554
    @softarn5554 7 ปีที่แล้ว

    The type or namespace name 'Form2' could not be found how do i fix this in my form? only "Form1" works but not "Form2"

  • @mohinisonawane991
    @mohinisonawane991 7 ปีที่แล้ว +1

    Thank you so much very helpful :-)

    • @CodAffection
      @CodAffection  7 ปีที่แล้ว +1

      thanks for the comment.

  • @gabrielavila953
    @gabrielavila953 6 ปีที่แล้ว

    how can i fix
    Error 1 An object reference is required for the non-static field, method, or property 'System.Windows.Forms.Control.Show()' c:\users
    eda\documents\visual studio 2010\Projects\WindowsFormsApplication1\WindowsFormsApplication1\Form1.cs 33 16 WindowsFormsApplication1

  • @ibtihelhacheni8365
    @ibtihelhacheni8365 6 ปีที่แล้ว

    the frmMain is not colored , what should i do ?

  • @programmer313
    @programmer313 2 ปีที่แล้ว

    Hi sir I have some problem when I write the correct username and password its show not correct I don't know why
    can you help me please?

  • @BoobstepBuminbass
    @BoobstepBuminbass 6 ปีที่แล้ว

    sda.fill(dtbl); is causing an error where it cannot find the file do you have any idea what might be wrong?

    • @CodAffection
      @CodAffection  6 ปีที่แล้ว

      ping me at askdotnetmob@gmail.com.

  • @hetulpatel9183
    @hetulpatel9183 7 ปีที่แล้ว

    it is necessary to any sql database is install in my laptop ?

    • @CodAffection
      @CodAffection  7 ปีที่แล้ว

      it's not necessary, you can access sql server from other connected systems also.

  • @mryan5522
    @mryan5522 4 ปีที่แล้ว

    but the password string anyone can see if they open sql server database. How can convert the password string into some unique symbol in sql server that is not the password we type in the text box?

  • @bomb4ik
    @bomb4ik 3 ปีที่แล้ว +1

    Thank you

  • @a1994s
    @a1994s 3 ปีที่แล้ว

    thanks a million bro.

  • @blacksmith9259
    @blacksmith9259 4 ปีที่แล้ว

    thank you very very mutch
    God Bless You

  • @LewdyBear
    @LewdyBear 7 ปีที่แล้ว

    he when i save the table it ask where i wanna save it then it isnt coming up in the table column i have refreshed and it still isnt there if you can help it would be appreciated greatly

    • @CodAffection
      @CodAffection  7 ปีที่แล้ว

      To see newly created table under tables you may need to refresh
      to save table Press ctrl + S Or Press Save Icon from top left corner
      it will show a pop up dialogue box - enter table name Click Ok that is it

  • @averageanon007
    @averageanon007 5 ปีที่แล้ว

    do you still have the "Do not delete" folder in C:/ drive? :p

    • @CodAffection
      @CodAffection  5 ปีที่แล้ว

      no, now it 'can be deleted'.

  • @sherifashref8833
    @sherifashref8833 6 ปีที่แล้ว

    the fill function does not work like that it say a missing .. the error message says that the server was not found or was not accessible

    • @CodAffection
      @CodAffection  6 ปีที่แล้ว

      please verify your connection string.

  • @JStream
    @JStream 6 ปีที่แล้ว

    this still works until now :D

  • @feeqqaa
    @feeqqaa 6 ปีที่แล้ว

    Hi, I'm using VS 2017. Thank you for this video, it is great and so helpful! But I followed exactly as what you have shown but when I entered the right credentials, it will run the else statement still. Do you know how I can fix this? Thank you in advance~!

    • @CodAffection
      @CodAffection  6 ปีที่แล้ว

      did you check with break points?

    • @feeqqaa
      @feeqqaa 6 ปีที่แล้ว

      CodAffection sorry, but how do I do that?

    • @CodAffection
      @CodAffection  6 ปีที่แล้ว

      th-cam.com/video/FKAOHtxiloA/w-d-xo.html

  • @akshaygadilkar8994
    @akshaygadilkar8994 7 ปีที่แล้ว

    Sir you are the best

    • @CodAffection
      @CodAffection  7 ปีที่แล้ว

      My Pleasure, Happy Coding

  • @bandaraharan9018
    @bandaraharan9018 5 ปีที่แล้ว

    It works, Thank you

  • @gandhidhamcomputers9664
    @gandhidhamcomputers9664 6 ปีที่แล้ว

    Thank you so much for the Code it will help me for life time

    • @CodAffection
      @CodAffection  6 ปีที่แล้ว

      Glad you found the video helpful.

    • @ksktamiltech4130
      @ksktamiltech4130 5 ปีที่แล้ว

      @@CodAffectionth-cam.com/video/VuAblmhisxc/w-d-xo.html

  • @atluong6236
    @atluong6236 7 ปีที่แล้ว

    Great. Thanks so much :D

  • @adampeck1320
    @adampeck1320 5 ปีที่แล้ว

    ive got a problem with the sda.Fill(dtbl); line

    • @CodAffection
      @CodAffection  5 ปีที่แล้ว

      please check connection string and stored procedure.

    • @dorotauszok9716
      @dorotauszok9716 5 ปีที่แล้ว

      The same. try "string query = "Select * from [Table] Where username = '" +textBox1.Text.Trim()..." my table name is "Table", when I add "[]" everything is ok :)

    • @serbiangames6233
      @serbiangames6233 5 ปีที่แล้ว

      @@dorotauszok9716 and me do you fix?

  • @yvonne981228ahvon
    @yvonne981228ahvon 7 ปีที่แล้ว +2

    i have the problem on sda.Fill(dtbl); , how to solve this problem

    • @imabik2378
      @imabik2378 6 ปีที่แล้ว

      Has anyone found the solution to this problem if so please reply asap

    • @kelvinescitnal6223
      @kelvinescitnal6223 6 ปีที่แล้ว

      you dont have a conection in your form 2

    • @scrub2657
      @scrub2657 5 ปีที่แล้ว

      and how do you fix this?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ty :)

    • @CodAffection
      @CodAffection  5 ปีที่แล้ว

      @@scrub2657 Please check db connection string and query string.
      If nothing works leave a message in fb page. let me check what I can do.

    • @singhpranshu3
      @singhpranshu3 5 ปีที่แล้ว

      @@CodAffection everything is fine. Just,
      sda.Fill(dtb1);
      is error

  • @mihaelborak78
    @mihaelborak78 6 ปีที่แล้ว

    @Dotnet Mob Hello i need help ! Every time i press login this shows up : Unhandled exception has occurred in your application...... Incorrect syntax near the keyword 'Table' pls help fast cuz i need 2 finish this project in 3 weaks and your tutorials helped me so far

    • @CodAffection
      @CodAffection  6 ปีที่แล้ว

      Let me see your query for login operation.

    • @Unreality_3D
      @Unreality_3D 5 ปีที่แล้ว +1

      @@CodAffection Hi i have the same problem, my login table is just called Table, also im using VS 2017,
      The Error...
      System.Data.SqlClient.SqlException
      HResult=0x80131904
      Message=Incorrect syntax near the keyword 'Table'.
      Source=.Net SqlClient Data Provider
      StackTrace:
      at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
      at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
      at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
      at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
      at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
      at System.Data.SqlClient.SqlDataReader.get_MetaData()
      at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
      at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
      at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
      at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
      at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
      at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
      at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
      at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
      at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
      at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
      at WindowsFormsApp6.loginFrm.loginBtn_Click(Object sender, EventArgs e) in C:\Users\Gary\source
      epos\WindowsFormsApp6\WindowsFormsApp6\Form1.cs:line 28
      at System.Windows.Forms.Control.OnClick(EventArgs e)
      at System.Windows.Forms.Button.OnClick(EventArgs e)
      at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
      at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
      at System.Windows.Forms.Control.WndProc(Message& m)
      at System.Windows.Forms.ButtonBase.WndProc(Message& m)
      at System.Windows.Forms.Button.WndProc(Message& m)
      at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
      at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
      at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
      at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
      at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
      at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
      at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
      at System.Windows.Forms.Application.Run(Form mainForm)
      at WindowsFormsApp6.Program.Main() in C:\Users\User\source
      epos\WindowsFormsApp6\WindowsFormsApp6\Program.cs:line 19
      My Code...
      SqlConnection sqlcon = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\User\source
      epos\WindowsFormsApp6\WindowsFormsApp6\Database\LoginData.mdf;Integrated Security=True;Connect Timeout=30");
      string query = "Select * From Table where username ='" + usernameTxt.Text.Trim() + "' and password = '" + passwordTxt.Text.Trim() + "'";
      SqlDataAdapter sda = new SqlDataAdapter(query, sqlcon);
      DataTable dtbl = new DataTable();
      sda.Fill(dtbl);
      if (dtbl.Rows.Count > 0 && dtbl.Rows[0][0].ToString().Equals("1"));
      {
      mainFrm objMainFrm = new mainFrm();
      this.Hide();
      objMainFrm.Show();
      }
      Thanks for the video i really needed this.

  • @randy4443
    @randy4443 4 ปีที่แล้ว

    I am not able to use datable for some reason. I type dataTable and throws error

    • @CodAffection
      @CodAffection  4 ปีที่แล้ว

      could you elaborate the actual issue in detail ?

  • @rw12player39
    @rw12player39 4 ปีที่แล้ว

    nice tutorial

  • @HANIFASATTAR
    @HANIFASATTAR 3 ปีที่แล้ว

    Very nice person

  • @mohideenasraf7837
    @mohideenasraf7837 7 ปีที่แล้ว

    why you cannot write string query into sql adapter ??? because thats an easy method ...

    • @CodAffection
      @CodAffection  7 ปีที่แล้ว

      stored procedures are pre-compiled, so better performance than string query.

  • @kageemo
    @kageemo 7 ปีที่แล้ว

    'System.Data.SqlClient.SqlException' occurred in System.Data.dll what this error when i try i get it

    • @CodAffection
      @CodAffection  7 ปีที่แล้ว

      Check Connection String Inside 'new SqlConnection(@"");'

    • @kageemo
      @kageemo 7 ปีที่แล้ว

      it my sda.fill(dt) that coming out this error

    • @josephinem.6286
      @josephinem.6286 7 ปีที่แล้ว

      i have the same error...

  • @abigailpartis392
    @abigailpartis392 6 ปีที่แล้ว

    I know others have asked, but i cant see the replies. I have an error on the sda.Fill(dtbl), I'm told "A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)" Any tips on how to fix this?

    • @CodAffection
      @CodAffection  6 ปีที่แล้ว +1

      ping me at askdotnetmob@gmail.com with possible screen shots.

    • @abigailpartis392
      @abigailpartis392 6 ปีที่แล้ว

      Dotnet Mob thank you but I figured it out. Daft mistake on my part 😂😂 thanks for the tutorial. Subbed.

    • @azizkarami5067
      @azizkarami5067 6 ปีที่แล้ว

      @Abigail Partis i got the same error can u help me ??

    • @CodAffection
      @CodAffection  6 ปีที่แล้ว

      please check your connection string.

  • @Smile-dk3eh
    @Smile-dk3eh 6 ปีที่แล้ว

    Main Menu - the window which opens after corrrect login. After closing Main Menu window the program doesn't close(

  • @rehanfarooq1122
    @rehanfarooq1122 5 ปีที่แล้ว

    thanks for this video bro

  • @malikmubashir9008
    @malikmubashir9008 5 ปีที่แล้ว

    Getting this error Plzz Help???
    Error 1 The type or namespace name 'frmMain' could not be found (are you missing a using directive or an assembly reference?

    • @Qyful
      @Qyful 5 ปีที่แล้ว

      Name your actual form 'frmMain'