exam questions

Exam 70-487 All Questions

View all questions & answers for the 70-487 exam

Exam 70-487 topic 1 question 100 discussion

Actual exam question from Microsoft's 70-487
Question #: 100
Topic #: 1
[All 70-487 Questions]

DRAG DROP -
You have table named Employee that has two columns named firstName and lastName.
You need to insert synchronously the first and last name of an employee into the Employee table.
Which five code segments should you use? Develop the solution by selecting and arranging the required code segments in the correct order.
You will not need all of the code segments.
NOTE:
Select and Place:

Show Suggested Answer Hide Answer
Suggested Answer:

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
MJKWandile
Highly Voted 5 years, 6 months ago
my answer would be using(SQLConnection connection = new SQLConnection("conn")) { Connection.Open(); string sql = "INSERT INTO..."; SqlCommand command= new SqlCommand(sql,connection); command.Parammeters.add(...); command.ExecuteNonQuey(); } What do u think?
upvoted 90 times
abalone
5 years, 6 months ago
agreed
upvoted 6 times
...
MaverickCalibre
5 years, 5 months ago
Few statements missing from selection of options but general idea is correct.
upvoted 2 times
mr_
4 years, 10 months ago
It looks like anything is missing and answer is perfectly fine. There are 5 statements and that was the requirement. Not all of the segments has to be used.
upvoted 2 times
...
...
...
Jobair
Most Recent 4 years, 8 months ago
I guees you should open the connection as late as possible
upvoted 2 times
Jobair
4 years, 7 months ago
I mean using(SQLConnection connection = new SQLConnection("conn")) { SqlCommand command= new SqlCommand(sql,connection); Connection.Open(); string sql = "INSERT INTO..."; command.Parammeters.add(...); command.ExecuteNonQuey(); }
upvoted 1 times
TimboJones
4 years, 7 months ago
While I agree, the sql variable get's declared within the connection.open block. Well, good luck using that variable for the sql command when you declare it two rows later. The compiler won't like this. So this means we need to get our connection using, open the connection first, so that we get the sql variable and use it for our command since everything afterwards relies on the command variable and of course we need to execute the command at the end
upvoted 3 times
...
...
...
supersunny
5 years, 4 months ago
MJKWandile well done.
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...