help with code

  • Thread starter Thread starter newman
  • Start date Start date
N

newman

Can anyone help me with code to do the following

I have a stored procedure that requires a date. What I
want to do is to write an application that runs that
stored procedure and prompts the user for date/s to be
entered to run the stored procedure.

Can anyone help??

Regards

Newman
 
Whislt I agree that this is totally off topic ...

use DateTimePicker controls to allow the user to select the dates and then
....


SqlCommand command = new SqlCommand("MyStoredProcedureName");
command.Connection = new SqlConnection(...);
command.Parameters.Add(@"@startDate", SqlDbType.DateTime).Value =
dateTimePicker1.Value.Date;
command.Parameters.Add(@"@endDate", SqlDbType.DateTime).Value =
dateTimePicker2.Value.Date;
command.ExecuteNonQuery();


create procedure MyStoredProcedureName
@startDate datetime,
@endDate datetime

as

set nocount on

-- do something with your dates

return

Note that in this example I have not renamed the DateTimePicker controls
from the VS defaults.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top