do i need classes or mvp
I have made the forum and the database and connected the database to the project but that's how far I gone I don't know what code I should add to the login button to make it work from SQL server, please help me I need this before Monday
45 Replies
In C# I assume?
Yes
Windows fourms
Double click the login button and what should I do from there databases and tables all made
Look into this to make a connection and execute a sql statement https://learn.microsoft.com/en-us/sql/connect/ado-net/introduction-microsoft-data-sqlclient-namespace?view=sql-server-ver16
Introduction to Microsoft.Data.SqlClient namespace - ADO.NET Provid...
Learn about the Microsoft.Data.SqlClient namespace and how it's the preferred way to connect to SQL for .NET applications.
What is ado and asl
Ignore that part
Google how to make a sql connection to a database
Alright hold on
Im lost
It's so much stuff is there one where it just says to connect a button to a table
Not really
Alright how about this, how do I change forums after loging through
Like if statement rows zero thing hide forum open the other
I just started like end of December please be patient with me
But hasn't your teacher shown you how to do stuff?
Feels weird you have to do db stuff without having at least a little lesson on how to make db connections in .NET
My teacher shows up twice a week warms a chair and leaves
Ikr
He said it's very simple
One project make a database management system
Is that more clearer
The idea is that you have a user object that gets populated when logged-in that you then can use through your app to do stuff
It won't be adding any new usernames and passwords
And I haven't implied that haha
There has to be a simple code to just check those two and let pass to another forum right
Please I'm so new to this if you cut me I'm pale green
A login form is just that:
Check if username exists in database
If it exists check that passwords hash are the same
If yes, connect the user and fill the user object for that user session (getting data from the database still)
Now my web pages can use that object. Checking it's not null, getting the username out of it, whatever it contains, to make custom pages for the user
Say it's one forum that comes after the login
Can I have a code please
I don't do spoon feeding I'm very sorry, it won't help you in the long run.
I can help you thinking about the logic, I can also help on code you have produced, but won't give you code
But like how am I supposed to find it if I don't know the code to use
Like sqlcommand I don't know when to use that
The link above kinda tells you
Sql command is when you want to interact with the database
Like, sending a SELECT query (or an insert)
For example for the login part, you would need a sqlcommand to check that the username exists
Are you telling me to study them all
Please can't you make an exception
I have only tomorrow now and I told myself I won't sleep till I make atleast the login
It's ten thirty I'm going to cry
I mean... that's kinda the purpose of studies.
When was the assignment given to you?
Not really and I also have other things to do than doing someone else code :/
Like, really, if you wish to become a dev, you need to do that yourself
And you would learn more from a failure than from someone handing you a solution
You don't understand I'm forced to do c# and SQL for marks
I don't know what's happening all I know is I will be hurt on Monday
I found this server in a rush even
Please please just the login
I'm really sorry if you're stuck on something you don't want to study then.
But I also really don't have the time to code for you.
I gave you the "algorithm" of a login. You gotta try from that.
You can also try getting help from your schoolmates.
But really can't help you more than what I'm doing here
Isn't code all the same
Mines prolly simpler even
Why do programers hate teaching beginners
they didnt want a spoonfeed cause everyone are want a copy and paste 😄
I don't hate teaching. You aren't asking for teaching. You are asking for solution. That is the opposite of teaching.
And no all codes aren't the same
thats why a coder, there`s a different method for making a code and optimize a work
And even if I had time to code for you I don't even know how your database looks like. So I could not code the login for you.
I feel like I've been very kind to you and trying to guide you to the solution
It's literally just username and password
Fine
Then I literally told you what you have to do. You are refusing the answer, it's different.
I'll make the login I'll study that big site thing and I'll make it by myself
And if I do that you have to help me for the rest
Now if you produce code and have issues with it, you can ask help with that, and we would help.
I'll just never give you a spoon-fed solution
And in the end you'll be proud of yourself because you understood the thing and did it by yourself
I will hurt myself
I'm going to study and fail now
Thanks somewhat
thats a part of life man, you didn`t learn when you are not getting failed
Alright
@Kao
I have a error
Please it's so early
I fixed them all but now it says SQL server certificate something
Now will someone help me?
Please
The exception is very clear. That's not a supported keyword in a SQL server connection string
Have you tried searching what the correct keyword should be?
I don't think YouTube has it
What I did was I copied the string from the database
Alright so it could be two things
It says initial catalog where I Think it should be the server name
And it says "keyword not supported" that's the other
Is initial catalog supposed to be there
This will probably help https://www.connectionstrings.com/microsoft-data-sqlclient/
Microsoft SqlClient Data Provider for SQL Server Connection Strings...
Connection Strings using Microsoft.Data.SqlClient for connections to SQL Server, Azure SQL Database, SQL Server 2019, SQL Server 2017, SQL Server 2016.
Shows all the various options for connection strings
Alternatively you can use this https://learn.microsoft.com/en-us/dotnet/api/system.data.sqlclient.sqlconnectionstringbuilder?view=dotnet-plat-ext-8.0
SqlConnectionStringBuilder Class (System.Data.SqlClient)
Provides a simple way to create and manage the contents of connection strings used by the SqlConnection class.
Thank you
The exception tells you which field is unsupported
I love you
It was stupid two spaces in between
It works now
Thank you all of you
There's no emoji to show how much I am happy right now
(つ✧ω✧)つ