How to pass SQL Command and Parameters to another form?

  • Thread starter Thread starter Tim
  • Start date Start date
T

Tim

Hi,

I am trying to pass a SQL Command, complete with parameters and their values
from one form to a modal form.

The modal form has;
public void GridDataPreload(System.Data.SqlClient.SqlCommand cmdPreload)
{
}

the calling form has;
fSaleItems.GridDataPreload(this.cmmSQLUpdateSaleReview);

At the point it is called the cmmSQLUpdateSaleReview has all the params and
their values in it.

When it is passed though it has the right count but none of the value names
(such as @Sale_id) and none of the values.

What has happened to them?

Tim
 
Hi,

post the code where you instantiate and pass the command to the modal form.



cheers,
 
Hi Ignacio here is the code: I instantiate the form set the command and then
show the form modally. Hoping you can help. Tim

MM.Forms.frmSelectSaleItems fSaleItems = new frmSelectSaleItems();
fSaleItems.GridDataPreload(this.cmmSQLUpdateSaleReview);
this.Cursor = Cursors.Default;
if (fSaleItems.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
{
itemSelect = true;
this.EnableDisableNextButton();
this.btnReviewItems.Enabled = true;
}
 
Back
Top