How to Create Multi User Login Form in C#.NET using SQL Server Database? [With Source Code]
Vložit
- čas přidán 21. 04. 2018
- Support us on Patreon: / runcodes
This video will show you how to create login form in c#.net for multiple user and redirect based on the user role.
Source Code:runcodes.tech/programming/csh...
Previous video: • How to Create Quiz App...
How to Create Login Form in C# with Database in Visual Studio?[With Source Code]: • How to Create Login Fo...
Create Simple Login Form in C#.NET without Database[With Source Code]: • Create Simple Login Fo...
How to Create Login Form in ASP.NET using SQL Server Database?[With Source Code]: • How to Create Login Fo...
How to Link ComboBox with Database and show values in TextBox if Select ComboBox in C#.NET?: • How to Link ComboBox w...
How to Link ListBox with Database and show values in TextBox if Select ListBox in C#.NET?: • How to Link ListBox wi...
Insert Update Delete and View Data From SQL Server Database in C#.NET[Part-1][With Source Code]: • Insert Update Delete a...
Insert Update Delete and View Data From SQL Server Database in C#.NET[Part-2][With Source Code]: • Insert Update Delete a...
Insert Update Delete and View Data From SQL Server Database in C#.NET[Part-3][With Source Code]: • Insert Update Delete a...
Insert Update Delete and View Data From SQL Server Database in C#.NET[Part-4][With Source Code]: • Insert Update Delete a...
How to Send Free SMS in C#.NET using SMS API?With Source Code]: • How to Send Free SMS F...
Send free SMS using C#[email-to-sms]: • How to Send Free SMS U...
Follow us on Social Media:
Facebook: RunCodesPage
Instagram: runcodes
Twitter: RunCodesTwit
This video is created by Ran and RunCodes own this video. Using of this video on other channels without prior permission will be strictly prohibited. (Embedding to the websites is allowed).. So stop copying and be a responsible people.
#MultiUserLogin #MultiUserLoginCsharp #CsharpMultiUserForm - Věda a technologie
you deserve double thumb up. you are just the answer to my prayer and research
do you like our work?
does this tutorial help you?
if so, you can support us at www.patreon.com/RunCodes
After watching too many videos, only you could help me
Really Help full. Thank you so much!
Thank you! Amazing video.
Very nicely explained. Keep up brother, well done ;)
Amazing work. Thank you!!!!!
Great job!
Nice 👍 video sir jee aap ka bhut bhut sukriya
thank you so much bro, Lov from MALAYSIA
worth the watch
Hi. Thanks for your tutorial but i already know this even have created a complete application with a single login form where user will select their role and get logged in to their dashboard.
But the same process follow for both a single user app and multi user.
Do you have such experience on how to deploy and run c# application with centralized database on multiple computers?
It worked Thank you👏
thank you so much ... it helped me a lot...once again tq so much....!!!!!
Its great, Thanks
Thank so much!
Thank you brother I get great benefit from your video
Thanks very much ,precise and simple
Dear friend.
Visit channel Solve My Programming Task. Thank you.
This video deserves way more likes and views lmao
thank you sir.... your video help me lot to make user login page
Very helpful dear
Dammi dai
Can u tell me how can we use radio button for user type in a replace of combo box...?
what's the changes of coding when we use 2 radio buttons
Thankyou!!!!
Thanks bro
I will try this tonight for my project.I will edit my comment if it worked 😊
thx bro
Лучший братан
Is it possible to create a personal dashboard that is user-specific not by roles in windows forms? You know by using sql database to store User logins and then whenever a specific user logs in he/she is then redirected to a personal profile windows form that is tied to his/her account?
Sure!
Hi,
Can I ask for a help, I tried the concept of your code to my project. The difference is I don't have a combo box for user type. What I want to happen is to open Form2 if the user type is admin, and open Form3 if the user type is equal to user, but all of this without that combo box from the form. I tried this but I had trouble with sda.
Can you help me with this one? Looking forward to hearing from you. Thank you.
Process is same just remove combobox code!
I'm unable to add the DB i've created to Visual Studio
first, when i tried to add a connection it asked me for some needed installation to be done and then it started to install it after it finished i've found my server exist on the data connection but i couldn't follow the method you mentioned which specify the DB i've created
and when i try to add another data connection i couldn't find the seer, so i typed the name of the server manually but i couldn't find my added database
Restart your server and try creating new project!
what if we dont want to ask from them if they are admin or user
Check only usertype! So write only usertype query in select query!
thank you for helping us
What if i didn't add any value in textbox and combox. Will they return error or? :/
nope! for this you have to validate!
thank you sir. subscribed
if username and password is ok but UserType(comboBox selection is empty or blank) the code goes into exception
When I execute the program the sda.Fill(dt); the error is "An unhandled exception of type 'System.InvalidOperationException' occurred in System.Data.dll"
Please answer
jhanine arriola did you fix it
It says System.NullReferenceException: 'Object reference not set to an instance of an object.' plus the usertype is not showing in the combobox how to fix this?
Contact us at facebook.com/TechSupportNep
love
can you make same like this without needed a combox to verify the usertype for user's pleaseee?.
that's not possible!
i want to know how to handle error when the user do not enter any value and do not select the combobox, because when i click button login without entring any value it is get me an error.
if txtUser.Text==""{
MessageBox.Show("Please enter username)
}else{
//yourcode
}
what if we didn't select the usertype can you please share the validation for combobox ?
Yes you can!
Anybody get error 40 when trying to connect to database
the code is incomplete, also don't see the point of having 2 extra empty forms. Thanks for the refresher, but complete working project would help.
hello, thanks for your work.I have a question, ı am making a project and ı dont know should i am write sql connection and datatable in every form code ?
Possibly yes!
@@RunCodes really thanks 👍🙏 and i have another question i wrote this code , when i click to login my PC pause
Dont know what going on with your PC, if your program run infinity this may be happened if not other hardware problem may persist!
@@RunCodes thank you 🙏
hello can you help me please ? i am making a login form with a combobox with multiple choice. but ı want to the items will come from sql not in combobox items. please help me . ı dont want to write cmbselected items. ı am new in coding please help.
How to Link ComboBox with Database and show values in TextBox if Select ComboBox in C#.NET?
czcams.com/video/jhXJwE8QdUE/video.html watch this video to solve your problem!
wowowow
Thank You very much Bro
Can you explain how I develop same login page in web application project
cannot see may dbo file pls help i created the login table but cant see dbo file
create database on sql server!
Bro the i'm having this error System.Data.SqlClient.SqlException: 'Incorrect syntax near 'login'.' in the sda.Fill(dt); can anyone help me please ?
you have error in your sql query check that!
Sir the massage of successful login and opening the form command is not working with me, What should I do?
May be the logic is not working so check you code properly
how do i connect to a server and get the database file on the side of the sql applacation
learn.microsoft.com/en-us/sql/integration-services/import-export-data/start-the-sql-server-import-and-export-wizard?view=sql-server-ver16
the cmbItemValue doesn't want to work by me... I already had my own code but all I needed was to make it multi user login. But with cmbvalue it just tells me it can't be found. Any idea why perhaps?
because you didn't defined it!
@@RunCodes I relooked at yours and then mine again and realized I just made an idiotic mistake on my end, still studying these things and have to learn a lot and your videos are actually helping a lot :P
I got error while running the code
SQL exception was unhandled (incorrect syntax near 'admin')
Please sir help me🙏
check your query there is an error!
can anyone in other computer can access or save data in your database created ?
Sure!
you an three layer for project this ?
what do you mean?
I follow your instruction but at the end error... column usertype does not belong to the table
Your column name maynot usertype! So write your column name or use index 2
for me after log in as a user he message that you are log in as a admin why ? why not user
Review your code!
if we are not selected any user type then come error how to solve it pls help me
Thats what we are creating in this project!
I have error in sda.(fill)
Error is an expression of non boolean type specified in context where a condition is expected, near 'id'.
sda.Fill(dt)
@@RunCodes pls tell how to solve this
@@RunCodes yes typing mistake it is sda.Fill(dt)
check your sql query there may be mistake
hmmm......my system got auto increment user id, I wanna ask, after login into the system, how do i make the user id of the logged in user also recorded as the logged in user key in data into the system, pls, I need ur help ;_;
Access your user id from database while logging in and when you logged in simply insert that id into your database!
@@RunCodes ............can u please give me an example?
after login, what I want is whenever the user insert information, their auto increment user id got inserted as well in the createby column, user id is pk in users table, but foreign key in the information table.......its like after clicking login button, the system hold the userid of the logged in user......how do I do tht and retrieve it so tht it will be recorded as the user inserting the information....;_;
Can you create it in java netbeans
czcams.com/video/4IFvc7JOqtA/video.html here it is :)
mine didn't work no errors nothing didnt go to the form 1 :(
Contact us on facebook!
[[ERROR]]
An unhandled exception of type 'System.InvalidOperationException' occurred in System.Data.dll
Additional information: Instance failure.
HAVING ERROR WHILE EXCECUTING. I BADLY NEED YOUR HELP.i NEED TO RUN THIS FOR TOMORROW DEADLINE.
you may have done such a operation which is supposed not to perform! Check your query!
@@RunCodes
sda.Fill(dt) ERROR
Use visual studio 2015
i am having a problem getting msql database connected in visual studio
add assembly!
error at sda.Fill(dt) not working...
contact us of facebook!
Thank you
How to create Log-in System (Log-In and Log-Out) with Log-in history complete with Database sql
Sir can you create same manner program in web application in c# for login page
Okey
I did exactly same as you said but its showing me the error that colomn usertype is not present in table but its there wht should i do
it means there is no such column in your database! Use same database column that you create in your sql server!
@@RunCodes i have used the same but then too its showing error🤦🏻♀️
@@RunCodes what should I do now?🤔
may be you used wrong table name! The problem is in your query, check it!
@@RunCodes ok
Can it work on mvc ?
Sure!
Error at of (dt.Rows.Count >0)
Rows!!! Underline Red !
Pls help me😭
dt.Rows.Count()>0
I got mistake with sda.Fill(dt) can u help me ?
error plz!
@@RunCodes system.invalidoperationexception fill selectcommand.connection property has not been initialized
Code plz
@@RunCodes send me your email i will send you my code
here-> facebook.com/TechSupportNep
Sir not working... I can't switch to form 2 /3 it's just executing the error block " error"
Means error in your query!
@@RunCodes yes sir , i did it thank you 😇
Sir how will come txtuser.text at 8:09
that is what we give the textbox name!
WORK GREAT!!!
Check this new method!
How to Create a User Registration Form in C#.NET using SQL Server Database and Visual Studio 2022?
czcams.com/video/TUKjALf7oOc/video.html
Hello this doesn’t work when I press login for me
Have a look at your query
I have one error pls anyone can solve it would be great help,
I am writing USERNAME as user and
In PASSWORD i am writing my password and
In SELECT TYPE i am selecting admin,
And when i clicked on login button it's showing me YOUR ARE LOGIN AS ADMIN,
Which is wrong it's should show me YOUR ARE LOGIN AS USER.
Pls anyone can solve this error, reply to this comment
Check your sql query!
it is not showing other forms not displaying any message only if you use a wrong credential it gives error! and it is also throwing null execption...please help
Dim con As SqlConnection = New SqlConnection("Data Source=CHIEF;Initial Catalog=Kololo;Integrated Security=True")
Dim cmd As SqlCommand = New SqlCommand("select * from login where username='" & txtUserName.Text & "' and userpassword='" + txtpassword.Text & "'", con)
Dim sda As SqlDataAdapter = New SqlDataAdapter(cmd)
Dim dt As DataTable = New DataTable()
sda.Fill(dt)
Dim cmbItemValue As String = Cuserlevel.SelectedItem.ToString()
If (dt.Rows.Count > 0) Then
Dim i As Integer = 0
Do While (i < dt.Rows.Count)
If (dt.Rows(i)("usertype").ToString = cmbItemValue) Then
MessageBox.Show(("you are login as " + dt.Rows(i)(2)))
If (Cuserlevel.SelectedIndex = 0) Then
Dim f As New Dashboard
f.Show()
Me.Hide()
Else
Dim ff As New Supplier_Details
Me.Hide()
ff.Show()
End If
End If
i = (i + 1)
Loop
Else
MessageBox.Show("error")
End If
the code is in vb.net
Dim cmd As SqlCommand = New SqlCommand("select * from login where
username='" & txtUserName.Text & "' and userpassword='" +
txtpassword.Text & "'", con)
here is error userpassword='"&txtpassword.Text&"'
thank you but i already corrected the error still doesnt open the form
please help
I will test in my pc and I will inform you but now I have no pc tomorrow I will comment the complete working code ok! Wait until tomorrow!
problem with sda.Fill(dt);
what's the error?
Send screenshot at facebook.com/TechSupportNep
I had same error and I had forgot to add 'con' variable in SqlCommand.
Example:
SqlCommand cmd = new SqlCommand("select * from Main_login where Username='"+txtuser.Text+"' and Password='"+txtpass.Text +"'",con);
my server name wont pop up and nither my database name
Watch this! Configure Visual Studio 2022 for .NET, .NET Framework and .NET Core? Win Form | SQL Server Database
czcams.com/video/rOhuQYKE2iQ/video.html
Not working for me
Nothing happened when click on login button
same
is username is your primary key?
No, but you make it.
i'm Error in sda.Fill(dt);
have a look at your code!
@Pairin Pandith I have same problem and it did not work on me.smh
Error in sda.Fill(dt);
what error did you get?
Exception unhandled
@@RunCodes same pls help
I messaged you on facebook just wondering if you could respond as I am having error every single time even if the right details. This would be great if u could message me back and we could fix this
2option of user is not login
??
nothing happens when i press login. why???
You have to write code inside the clicking event of login button!
@@RunCodes i did that. im using mysql from myphp localhost. should i use a different code
@@RunCodes this is my code
MySqlCommand cmd = new MySqlCommand("SELECT * FROM `users` WHERE `username` = '"+tbuser.Text+ "'AND `password` = '" + tbpass.Text + "'", connection);
MySqlDataAdapter sda = new MySqlDataAdapter(cmd);
DataTable dt = new DataTable();
sda.Fill(dt);
String cmb = comboBox1.SelectedItem.ToString();
if (dt.Rows.Count > 0)
{
for (int i = 0; i>dt.Rows.Count; i++)
{
if (dt.Rows[i][3].ToString()== cmb)
{
MessageBox.Show("You are logged in as " + dt.Rows[i][3]);
if (comboBox1.SelectedIndex == 0)
{
admin ad = new admin();
ad.Show();
this.Hide();
}
else
{
frontdesk frontdesk = new frontdesk();
frontdesk.Show();
this.Hide();
}
}
}
}
else
{
MessageBox.Show("error");
}
Watch this video: czcams.com/video/JGPhybZvdck/video.html
Same in web application please...
Okey!
When you create video?? because I am creating a web application so can you help me...please
czcams.com/video/Fu9ugKmxrzo/video.html this is in php but if you want in asp.net follow the c#.net code! Whole code is same!
Thank you very very much sir...
in asp.net -> czcams.com/video/Rnpb_OKuYAM/video.html
The provided source code link only contains adds 😠😠
click that like button, code will display!
It isn't working
what is error?
Exception unhandled
contact us at facebook.com/TechSupportNep