|
GuyThiebaut wrote: YES!!! I like your thinking outside of the box. It could be a team building exercise
Because "getting people into a BOX" is the first step in thinking outside of one?
|
|
|
|
|
It is a question in exam. We either can get full marks, or get a zero.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Afzaal Ahmad Zeeshan wrote: There is a question, "write the procedure to connect to database". Procedural web-development? Yup, sounds like a "professor".
In the modern world, the framework provides interfaces to connect. Set the factory in the config file and of you are.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
If only it was that simple.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
If you are using .NET, it is. As long as your SQL is SQL92 compliant, you'll be able to talk to most databases using simply some configuration.
Documented on MSDN
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I guess the word procedure is meant in its literal format, if so my answer would be the script/code to connect to mysql via php using your own db table username and password, and an explanation of what the arguments are for in the connection code. You might get extra marks for inferring about a stored procedure and need a connection to access the SP.
|
|
|
|
|
Afzaal Ahmad Zeeshan wrote: No framework given, no guidance on what framework we are talking about, no name of database.
void Connect(IDb db, string dbName)
{
db.Connect(dbName);
}
Done!
Marc
|
|
|
|
|
That's a method, not a procedure
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Eddy Vluggen wrote: That's a method, not a procedure
Well, SQL Server can run C# code.
Marc
|
|
|
|
|
|
PIEBALDconsult wrote: con.
let us debate the use of meaningful names in one's code. con | cnx | cn or my favorite connection.Open()
or not.
|
|
|
|
|
Maybe his framework doesn't allow names more than four characters long.
|
|
|
|
|
public void CheckDatabaseConnection()
{
try
{
using (new MyDbContext())
{
return true;
}
}
catch (Exception ex)
{
return false;
}
} I think that should be it, from the top of my head
Of course I had to make some assumptions regarding language, framework and database, but they weren't mentioned
|
|
|
|
|
void or bool on your method signature return type?
|
|
|
|
|
Uhhh... Yes, that was the homework!
Spot the error.
You passed the test.
Good work, young padawan.
|
|
|
|
|
|
1) open an editor
2) start typing the code
3) when coding ready, compile it
... 3a) If compiling errors, solve them
... 3b) If no errors, go to next point
4) test the application and search for runtime errors
... 4a) If runtime errors, solve them
... 4b) If no error, go to next point
5) deploy
is the procedure clear enough?
I'll go get my coat
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
it's like real life!!
your clueles boss comes up with vague spec.
You need to discuss with him for some possible solution...
|
|
|
|
|
Here is the code for ADO.NET that opens a SQL database for you...
Note: "csConnectionString" is a class level variable declaration
Friend Sub Execute_OpenConnection(ByRef poSqlConnection As SqlConnection)
Try
poSqlConnection = New SqlConnection(csConnectionString)
poSqlConnection.Open()
Catch loSqlException As SqlException
Throw loSqlException
Catch loException As Exception
Throw loException
End Try
End Sub
Steve Naidamast
Sr. Software Engineer
Black Falcon Software, Inc.
blackfalconsoftware@outlook.com
|
|
|
|
|
If Sigmund stood on a banana, would that be a Freudian slip?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Ahh we need a :boomTish: emoticon
|
|
|
|
|
after that would certainly be a good idea for him to lie down on his couch
Sin tack ear lol
Pressing the any key may be continuate
|
|
|
|
|
No. Sometimes a banana is just a banana.
|
|
|
|
|
When he hit the ground and uttered an obsenity if no one was around to hear it would it still be obscene?
New version: WinHeist Version 2.2.2 Beta I told my psychiatrist that I was hearing voices in my head. He said you don't have a psychiatrist!
|
|
|
|
|
Where's the proof anything was uttered?
I mean it's not as if there would be a dead tree lying about to show for it.
So no, would not be obscene, nor even an utterance.
(Unless the cat was watching, I hear they are bringing them out with IoT pretty soon.)
Sin tack ear lol
Pressing the any key may be continuate
|
|
|
|