C
C#7mo ago
Eve.

✅ Checking data from SQL database

help on verge of tears
No description
No description
72 Replies
Angius
Angius7mo ago
The method is not static So you need to call it on an instance of the class You create one such instance on the line above
Eve.
Eve.OP7mo ago
this confuses me which line
Angius
Angius7mo ago
No description
Angius
Angius7mo ago
The one above
Eve.
Eve.OP7mo ago
okay i dont understand how i would fix it
Angius
Angius7mo ago
Call the method on this instance Not on the class itself
Eve.
Eve.OP7mo ago
No description
Eve.
Eve.OP7mo ago
like that
Angius
Angius7mo ago
Yes
Eve.
Eve.OP7mo ago
okay
Angius
Angius7mo ago
But, the method also needs some parameters
Eve.
Eve.OP7mo ago
No description
Angius
Angius7mo ago
It wants an instance of UserDetails, namely
No description
Eve.
Eve.OP7mo ago
i did these what does namely mean
Angius
Angius7mo ago
"To be precise, to use a proper name here instead of refering to it vaguely, it wants an instance of UserDetails"
Angius
Angius7mo ago
Which you created here
No description
Eve.
Eve.OP7mo ago
i dont understand what i need to do i am quite new at this
Angius
Angius7mo ago
If you're new to this, you shouldn't be trying to connect to a database from a Winforms app
Eve.
Eve.OP7mo ago
it works
Angius
Angius7mo ago
Let me recommend $helloworld
Eve.
Eve.OP7mo ago
it is a project due on saturday so i have to do this for 20% of my grade
Angius
Angius7mo ago
And, to answer your question, if a method says it wants some parameter, you gice it that parameter This method wants an instance of UserDetails, so you should give it one
Eve.
Eve.OP7mo ago
what does instance mean like to define it?
Angius
Angius7mo ago
No idea how to define it besides "instance is an instance" You instantiate classes with new What you get from new Foo() is an instance of class Foo
Eve.
Eve.OP7mo ago
ahh okay @jiniux can you help me
jiniux
jiniux7mo ago
what is the problem?
Eve.
Eve.OP7mo ago
at the top idk how to fix it at all
Angius
Angius7mo ago
I told you exactly how?
Eve.
Eve.OP7mo ago
idk what instanciate means idk what to instanciate and idk where or what class
Angius
Angius7mo ago
So you resorted to pinging random people instead of asking lmao
jiniux
jiniux7mo ago
probably pinged me because i helped them some days ago
Angius
Angius7mo ago
To isntantiate means to create an instance You have all the necessary instances of all the necessary classes already made You even called the correct method on the correct instance Now, the method only needs a parameter You have the instance needed for that already This one Now just pass it as a parameter to your method
Eve.
Eve.OP7mo ago
idk how to do that
Angius
Angius7mo ago
Method(parameter)
MODiX
MODiX7mo ago
Angius
REPL Result: Success
string text = "Hello World";
Console.WriteLine(text);
string text = "Hello World";
Console.WriteLine(text);
Console Output
Hello World
Hello World
Compile: 396.546ms | Execution: 22.056ms | React with ❌ to remove this embed.
Angius
Angius7mo ago
Here, I am passing text to the WriteLine() method
Eve.
Eve.OP7mo ago
so i need to do UserConfirmed(parameter)
Angius
Angius7mo ago
Yes
Eve.
Eve.OP7mo ago
No description
Angius
Angius7mo ago
The parameter needs to be an instance of UserDetails
Eve.
Eve.OP7mo ago
No description
Eve.
Eve.OP7mo ago
im not too sure where to do this
Angius
Angius7mo ago
Yes, the method tells you exactly what the parameter should be
No description
jiniux
jiniux7mo ago
UserDetailsBindingSource.DataSource = userDetails.DAO.UserConfirmed(userDetails)
Angius
Angius7mo ago
You have an instance of user details
No description
Angius
Angius7mo ago
Pass that to the method
Eve.
Eve.OP7mo ago
idk how to do that so i do
Angius
Angius7mo ago
No description
Eve.
Eve.OP7mo ago
No description
Angius
Angius7mo ago
userdetails is a variable that stores the instance of UserDetails userDetails variable does not exist C# is case-sensitive
Eve.
Eve.OP7mo ago
ohh okay the error is gone now thank you
Eve.
Eve.OP7mo ago
No description
Eve.
Eve.OP7mo ago
does you know what this means my database is called loginpage
Eve.
Eve.OP7mo ago
No description
Angius
Angius7mo ago
The table is called userdetails though
Eve.
Eve.OP7mo ago
i changed this
No description
Angius
Angius7mo ago
Yes
Eve.
Eve.OP7mo ago
i changed the loginpage to usersdetails
Angius
Angius7mo ago
The database is called loginpage The table is called userdetails You connect to the database loginpage Then you have to query the table userdetails
Angius
Angius7mo ago
No description
Eve.
Eve.OP7mo ago
is that through the sql statement
Eve.
Eve.OP7mo ago
No description
Eve.
Eve.OP7mo ago
No description
Eve.
Eve.OP7mo ago
now its saying it can't find password but they're all called the same thing and the other one works
Angius
Angius7mo ago
Well, does your table have a column named Password?
Eve.
Eve.OP7mo ago
No description
Eve.
Eve.OP7mo ago
yes
Angius
Angius7mo ago
No description
Angius
Angius7mo ago
No description
Angius
Angius7mo ago
Spot the difference
Eve.
Eve.OP7mo ago
omg it works now thank you sweat and tears gone
Want results from more Discord servers?
Add your server