How does u call and execute a sp in .net?



How does u call and execute a sp in .net?..

Answer / Lokendra Singh Rajput

In .NET, you can call and execute stored procedures using the SqlCommand object. Here's an example: n```csharpnusing (SqlConnection connection = new SqlConnection(connectionString))n{n connection.Open();nn using (SqlCommand command = new SqlCommand(storedProcedureName, connection))n {n command.CommandType = CommandType.StoredProcedure;n // Add any parameters if neededn DataTable dataTable = new DataTable();n using (SqlDataAdapter adapter = new SqlDataAdapter(command))n {n adapter.Fill(dataTable);n }n }n}n```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More ASP.NET Interview Questions

Define web services in asp.net.

1 Answers  


1. What is the difference between Cache and Session? 2. I cache limited to page like viewstate or it's accessible through out the application like session? 3. Which one is better when I've some data that is to be used across the application? Why is to better than the other?

2 Answers   247Customer,


code for "For every 5days system has to create 1text file with the corresponding date and it has to store in c-drive" by using web applications

1 Answers  


What is the difference between client-side and server-side validations in ASP.NET?

1 Answers   Sans Pareil IT Services,


What are runtime hosts?

4 Answers   Microsoft,


What is the use of session?

1 Answers  


Explain the components of web form in asp.net

1 Answers  


What is a proxy in web service?

1 Answers  


What is state management technique?

1 Answers  


Explain what benefit does your code receive if you decorate it with attributes demanding specific security permissions?

1 Answers  


What is difference between asp.net and asp?

1 Answers  


What language does asp.net use?

1 Answers  


Categories