How to prompt user for info using stored procedure

  • 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
 
How much do you have done? You can basically have a form that has a myDate
Property. On it, have a DateTimePicker Control. When the user selects a
date, set the property (How you'll handle it if the user doesn't pick a date
is up to you.) However, once the Ok button (or whatever you want to call it
is clicked, make sure the property is set:

So from the caller, you can do something like this:

myDataForm md = new MyDataForm();
md.ShowDialog();

//When the form is closed, you will have already set the property

SqlCommand cmd = new SqlCommand("usp_MyDateProc", myConnection);

cmd.Parameters.Clear();
cmd.Parameters.Add("@MyDateValue", SqlDbType.SmallDateTime)
cmd.Parameters("@MyDateValue").Value = md.MyDate;

cmd.CommandType = CommandType.StoredProcedure...

i'm leaving out the initialization of the connection, but this should give
you a pretty good idea of what to do.


Cheers,

Bill
 
Back
Top