PrepAway - Latest Free Exam Questions & Answers

Which code segment should you use?

Your Microsoft SQL Server database has a stored procedure named GetCompanyName. GetCompanyName accepts one parameter named @CustomerID and returns the appropriate company name. You instantiate a SqlCommand object named myCommand. You need to initialize myCommand to return the company name for @CustomerID with a value of “ALFKI”. Which code segment should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
myCommand.CommandText = “GetCompanyName, ALFKI”;
myCommand.Parameters.Add(“@CustomerID”);

B.
myCommand.CommandText = “GetCompanyName”;
myCommand.Parameters.Add(“GetCompanyName”, “ALFKI”);

C.
myCommand.CommandText = “@CustomerID”;
myCommand.Parameters.Add(“GetCompanyName”, “ALFKI”);

D.
myCommand.CommandText = “GetCompanyName”;
myCommand.Parameters.Add(“@CustomerID”, “ALFKI”);


Leave a Reply