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#
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.
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 ;)
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?
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.
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
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.
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
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.
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
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.
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
I am glad you found the video useful. Get Logged In and Out Time - Add two additional column of the type date time one for logintime and logouttime - During Login Insert DateTime.Now to logintime - During Logout Update Current User Last Row - logouttime with DateTime.Now
Not a separate file. I mean add two columns in tblUser table. for logintime and logout. Or You can keep a separate table - tblUserAudit to store login time and logout time.
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.
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.'
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~!
@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 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.
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
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
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.'
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.
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.
I don't think so. you have to enclose sql object inside '[ ]' if it contains a space or reserved terms like 'User'. Otherwise it is not necessary. thanks for the comment.
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?
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?
and how do you fix this?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ty :)
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?
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
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#
I am beginner to C#. Search many places. But your explained the working method step by step. Thanks a lot.
Glad to hear that
even after 4 years it`s a best video. thx man
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.
did u finish it?
@@ishkasewshanker3813 we hope so
Tried this for a project i am building, very helpful Thank you. You should upload some recent videos like this of Visual Studio 2019
Thanks man i have windows app interview today thanks a lot
This helped me a lot😊thank youw❤
Best tutorial so far for login authentication..
I am glad you found the video helpful.
Great tutorial, Thank you.
Thank you very much! My software buyers can now safely use their purchased program!
glad you found the video helpful in your live projects.
What a load lol, if anyone was buying software it wouldnt be from someone who couldnt make a login form.
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'.'
Same
Crystal clear! Thanks a lot.
Thank you very much, it worked perfectly!
I'm glad it helped.
thankyou you just saved my life
Thanks for the help, it worked🎉
Thank you.!
Thank you sir! Very good tutorial.
Your are the Best mate! straightforward and easy to follow the steps, Thanks...
you are welcome, by the way thanks for watching my video
thank you so much! ❤
Crystal clear. Thanks for the explanation, it really helped!
Bro much love for you you helped me a lot i loveyou so much have a great life
thanks for the wonderful comment.
Thanks! Its working :D
Super gooooood!!! Thank you!)))
*YOU ARE THE BEST!!!*
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
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 ;)
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?
I love u man, thank u :)
this helped me thank you bro
This was pretty helpful. Thanks a mill
Thanks Lot very helpful keep it up !!!
god bless you and your voice
Thank You Sir....!!!!
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.
thanks for the info . hope you found this C# tutorial helpful.
@@CodAffection yes sir, your turorial has helped me a lot. Thank you so much !
Thanks alot man, very useful!!
:)
Thank you
sir! thank you!its works fine!
You helped me a lot. Thank you!
you are welcome.
Thank you very much for this.
very useful thanks a lot
Use secure procedure is better than leaving open SQL query string
this still works until now :D
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
sorry, I didn't get you.
Thank you For helping Others!!!!!!
Thank you it has Great tutorial
nice uploade more video related windows form
Thank you so much for the Code it will help me for life time
Glad you found the video helpful.
@@CodAffectionua-cam.com/video/VuAblmhisxc/v-deo.html
Thank you so much very helpful :-)
thanks for the comment.
thanks a million bro.
Thanks a lot❤️❤️❤️❤️
Sir you are the best
My Pleasure, Happy Coding
thank you very very mutch
God Bless You
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.
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
😍😇 thnk U sO mUch sir !!
Great. Thanks so much :D
you are welcome
7:58 when i clicked new table an error occured called : "An incompatible SQL server version was detected "
What should i do man?
Have you tried this : stackoverflow.com/a/27881800/4133590
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.
im stuck there aswell, hope u found an answer after a year xD
It works, Thank you
nice tutorial
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
8:36 could you explain what do you say there?
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.
Thank you for fast answer. I appreciate all work that you put into your videos. It is very helpful. Thank you! :)
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
same thing(((
You are awesome. This is so helpful.
How can i get a report that what user at what time/date logged in and logged out?
Thank you :)
I am glad you found the video useful.
Get Logged In and Out Time
- Add two additional column of the type date time one for logintime and logouttime
- During Login Insert DateTime.Now to logintime
- During Logout Update Current User Last Row - logouttime with DateTime.Now
Dotnet Mob Thanks for you reply.
Where would that log file go once i completed compiling the program.
Thank you
Not a separate file. I mean add two columns in tblUser table. for logintime and logout.
Or You can keep a separate table - tblUserAudit to store login time and logout time.
Dotnet Mob Thank you :)
You are welcome
Thank you very much !!!!
you are welcome.
thanks for this video bro
Very nice person
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.
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.
@@hackslash834 ya i fixed the issue thanks for the comment.
thanks for sharing your thoughts.
thanks bruda
Thanks!
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.'
try this stackoverflow.com/a/14779107/4133590
Thank you!!!!!
Thank you si much
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~!
did you check with break points?
CodAffection sorry, but how do I do that?
ua-cam.com/video/FKAOHtxiloA/v-deo.html
thanks bro
thanks a lot :)
so sweet
Life saver
query one record then direct to main form to open but not to match successfully with bool true.
how can i display the name of the user who logged in to the next form?
you need the database varible and in textlabel script
label.text = "varible"
@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
Let me see your query for login operation.
@@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.
Good
Server Explore in Data Connections in LoginDB in Table in File do not show.
Please sir Help me
same
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
same thing happens to me
You may try to save it under the db location and refresh table
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
Merci 🙂
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.'
did you download the source code ?
Yes... can you teach me how to enter RC4 encryption for the password?
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?
this li- HMHHM
16:06
Lol that load
How to create it for multi user so every one has different form apperead after logging in??
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.
you want to connect Live SQL Server Database ?
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.
When he cleared his throat my ears were gone
zooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooom
clear e he bhai
You must write "tblLogin" between [ ] otherwise it cause error sometimes
I don't think so. you have to enclose sql object inside '[ ]' if it contains a space or reserved terms like 'User'. Otherwise it is not necessary. thanks for the comment.
Dotnet Mob
welcome,
but I try this code without [ ] this caused an error, then I fixed it by write this brackets.
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?
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?
ping me at askdotnetmob@gmail.com with possible screen shots.
Dotnet Mob thank you but I figured it out. Daft mistake on my part 😂😂 thanks for the tutorial. Subbed.
@Abigail Partis i got the same error can u help me ??
please check your connection string.
i have the problem on sda.Fill(dtbl); , how to solve this problem
Has anyone found the solution to this problem if so please reply asap
you dont have a conection in your form 2
and how do you fix this?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ty :)
@@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.
@@CodAffection everything is fine. Just,
sda.Fill(dtb1);
is error
The name 'ObjFrmMain' not exist at the current context. could you help me please?
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?
please SQL server connection string.
Already fix this thank you i just downloaded the sql server
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
If Textbox = txt , Button = btn, (Control Naming)
txt.Text =(Convert.ToInt32(txt .Text)+ 1).ToString();
can you do a video on how to do a multi user login
do you still have the "Do not delete" folder in C:/ drive? :p
no, now it 'can be deleted'.
Thanks