Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Computer Certification > MCSD > Can you answer this ?

Reply
Thread Tools

Can you answer this ?

 
 
cj
Guest
Posts: n/a
 
      07-13-2003
I picked up a sample exam from Examsheets for the 070-315 exam and this was one of the questions.

Your ASP.NET application enables customers to create new sales orders. The sales orders are stored in a Microsoft SQL Server database table. The table has an IDENTITY column named OrderID. Your code uses a DataTable object to manage the order data. The DataTable object contains a column named OrderNumber. You use the Update method of a SqlDataAdapter object to call a stored procedure that inserts each new order into the database. The stored procedure uses a parameter to returns the new OrderID value for each order.
You assign a SqlCommand object to the InsertCommand property of the SqlDataAdapter object. You add a SqlParameter object to the Parameters collection of the SqlDataAdapter object, specifying the name and data type of the parameter.

You need to set properties of the SqlParameter object to retrieve new OrderID values from the database into the OrderNumber column of your DataTable object.

What should you do?

A. Set the Direction property to ParameterDirection.ReturnValue. Set the SourceColumn property to "OrderID".

B. Set the Direction property to ParameterDirection.ReturnValue. Set the SourceColumn property to "OrderNumber".

C. Set the Direction property to ParameterDirection.Output. Set the SourceColumn property to "OrderID".

D. Set the Direction property to ParameterDirection.Output. Set the SourceColumn property to "OrderNumber".

The answer they gave was A, but that seems very wrong to me, since the SourceColumn should be the column in the datatable that the value is coming from or going into. My answer was B (since it says the SP returns the OrderID value I assumed it was a return value)

Does anyone have any insight as to why that would be their answer, or are they wrong ?

Cheers,

CJ
 
Reply With Quote
 
 
 
 
Simon Smith
Guest
Posts: n/a
 
      07-13-2003
On Sun, 13 Jul 2003 12:18:00 +0800 in article
<(E-Mail Removed)> in
microsoft.public.cert.exam.mcsd , "cj" <(E-Mail Removed)>
wrote:

>I picked up a sample exam from Examsheets for the 070-315 exam and this was one of the questions.
>
>Your ASP.NET application enables customers to create new sales orders. The sales orders are stored in a Microsoft SQL Server database table. The table has an IDENTITY column named OrderID. Your code uses a DataTable object to manage the order data. The DataTable object contains a column named OrderNumber. You use the Update method of a SqlDataAdapter object to call a stored procedure that inserts each new order into the database. The stored procedure uses a parameter to returns the new OrderID value for each order.
>You assign a SqlCommand object to the InsertCommand property of the SqlDataAdapter object. You add a SqlParameter object to the Parameters collection of the SqlDataAdapter object, specifying the name and data type of the parameter.
>
>You need to set properties of the SqlParameter object to retrieve new OrderID values from the database into the OrderNumber column of your DataTable object.
>
>What should you do?
>
>A. Set the Direction property to ParameterDirection.ReturnValue. Set the SourceColumn property to "OrderID".
>
>B. Set the Direction property to ParameterDirection.ReturnValue. Set the SourceColumn property to "OrderNumber".
>
>C. Set the Direction property to ParameterDirection.Output. Set the SourceColumn property to "OrderID".
>
>D. Set the Direction property to ParameterDirection.Output. Set the SourceColumn property to "OrderNumber".
>
>The answer they gave was A, but that seems very wrong to me, since the SourceColumn should be the column in the datatable that the value is coming from or going into. My answer was B (since it says the SP returns the OrderID value I assumed it was a return value)
>
>Does anyone have any insight as to why that would be their answer, or are they wrong ?
>
>Cheers,


From the question: "The stored procedure uses a parameter to returns
the new OrderID value"

You didn't read the question closely enough.

Another clue: "The table has an IDENTITY column named OrderID."
That's probably the one you want, then. (You understand that, don't
you?)

So the given answer of A is correct.

You message came through to me full of HTML tags. This is hard to read
in a text-only reader (and Usenet is a text-only medium) so I ignored
the rest. Sorry.



--
Simon
simon dot smith at snowvalley dot com
"Insomnia is a small price to pay for the stuff you read on UseNet"
 
Reply With Quote
 
 
 
 
Alan Davis
Guest
Posts: n/a
 
      07-13-2003
> So the given answer of A is correct.

Interesting. It is common practice that return values from sql server
store procedures should return only the status of the action i.e.
success or failure, not the result of some operation.

Simon Smith wrote:
> On Sun, 13 Jul 2003 12:18:00 +0800 in article
> <(E-Mail Removed)> in
> microsoft.public.cert.exam.mcsd , "cj" <(E-Mail Removed)>
> wrote:
>
>
>>I picked up a sample exam from Examsheets for the 070-315 exam and this was one of the questions.
>>
>>Your ASP.NET application enables customers to create new sales orders. The sales orders are stored in a Microsoft SQL Server database table. The table has an IDENTITY column named OrderID. Your code uses a DataTable object to manage the order data. The DataTable object contains a column named OrderNumber. You use the Update method of a SqlDataAdapter object to call a stored procedure that inserts each new order into the database. The stored procedure uses a parameter to returns the new OrderID value for each order.
>>You assign a SqlCommand object to the InsertCommand property of the SqlDataAdapter object. You add a SqlParameter object to the Parameters collection of the SqlDataAdapter object, specifying the name and data type of the parameter.
>>
>>You need to set properties of the SqlParameter object to retrieve new OrderID values from the database into the OrderNumber column of your DataTable object.
>>
>>What should you do?
>>
>>A. Set the Direction property to ParameterDirection.ReturnValue. Set the SourceColumn property to "OrderID".
>>
>>B. Set the Direction property to ParameterDirection.ReturnValue. Set the SourceColumn property to "OrderNumber".
>>
>>C. Set the Direction property to ParameterDirection.Output. Set the SourceColumn property to "OrderID".
>>
>>D. Set the Direction property to ParameterDirection.Output. Set the SourceColumn property to "OrderNumber".
>>
>>The answer they gave was A, but that seems very wrong to me, since the SourceColumn should be the column in the datatable that the value is coming from or going into. My answer was B (since it says the SP returns the OrderID value I assumed it was a return value)
>>
>>Does anyone have any insight as to why that would be their answer, or are they wrong ?
>>
>>Cheers,

>
>
> From the question: "The stored procedure uses a parameter to returns
> the new OrderID value"
>
> You didn't read the question closely enough.
>
> Another clue: "The table has an IDENTITY column named OrderID."
> That's probably the one you want, then. (You understand that, don't
> you?)
>
> So the given answer of A is correct.
>
> You message came through to me full of HTML tags. This is hard to read
> in a text-only reader (and Usenet is a text-only medium) so I ignored
> the rest. Sorry.
>
>
>


 
Reply With Quote
 
Yakov
Guest
Posts: n/a
 
      07-14-2003
imho, A is correct.
As I understand 'returnValue' refers to SQL. Not to your
DataSet/DataTable.

>You need to set properties of the SqlParameter object to

retrieve new OrderID values from the database into the
OrderNumber column of your DataTable object.

>A. Set the Direction property to

ParameterDirection.ReturnValue. Set the SourceColumn
property to "OrderID".

 
Reply With Quote
 
Yakov
Guest
Posts: n/a
 
      07-14-2003
"to retrieve new OrderID values from the database into the
OrderNumber column of your DataTable object."

This phrase confusing me. Why would you set OrderID to
OrderNumber.. and how (using DataAdapter).

So, sorry folks, I don't know the answer.


 
Reply With Quote
 
Vineet
Guest
Posts: n/a
 
      07-14-2003
Hi.. I might sound nieve however.. i would like to ask shouldnt the
answer be

C. Set the Direction property to ParameterDirection.Output. Set the
SourceColumn property to "OrderID".

beacause we are using a parameter in StoredProc and I guess we use
ParameterDirection.Output when we use parameter in a SP.. and Return
Value other wise. I would be very happy if you could correct me..

Thanks,
~V

"Yakov" <(E-Mail Removed)> wrote in message news:<037f01c349b5$91da0ac0$(E-Mail Removed)>...
> imho, A is correct.
> As I understand 'returnValue' refers to SQL. Not to your
> DataSet/DataTable.
>
> >You need to set properties of the SqlParameter object to

> retrieve new OrderID values from the database into the
> OrderNumber column of your DataTable object.
>
> >A. Set the Direction property to

> ParameterDirection.ReturnValue. Set the SourceColumn
> property to "OrderID".

 
Reply With Quote
 
Alan Davis
Guest
Posts: n/a
 
      07-14-2003
Correct.

Vineet wrote:
> Hi.. I might sound nieve however.. i would like to ask shouldnt the
> answer be
>
> C. Set the Direction property to ParameterDirection.Output. Set the
> SourceColumn property to "OrderID".
>
> beacause we are using a parameter in StoredProc and I guess we use
> ParameterDirection.Output when we use parameter in a SP.. and Return
> Value other wise. I would be very happy if you could correct me..
>
> Thanks,
> ~V
>
> "Yakov" <(E-Mail Removed)> wrote in message news:<037f01c349b5$91da0ac0$(E-Mail Removed)>...
>
>>imho, A is correct.
>>As I understand 'returnValue' refers to SQL. Not to your
>>DataSet/DataTable.
>>
>>
>>>You need to set properties of the SqlParameter object to

>>
>>retrieve new OrderID values from the database into the
>>OrderNumber column of your DataTable object.
>>
>>
>>>A. Set the Direction property to

>>
>>ParameterDirection.ReturnValue. Set the SourceColumn
>>property to "OrderID".


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wrong answer equals to a blank answer or not? Zadkin Microsoft Certification 8 06-27-2006 01:51 PM
CISCO PIX hard question, can you answer it? TIA pauleknight@gmail.com Cisco 6 09-01-2005 11:38 PM
Can't Find Answer Any Where (What would you do/try): fopen ("file on shared drive","w+") doesn't work on 2nd call using Windows LabView DDL clusardi2k@aol.com C++ 1 08-17-2005 01:31 PM
What does deprecated mean? Are you sure you know the right answer? Richard HTML 15 02-13-2005 11:42 PM



Advertisments