How to pass SQL Command and Parameters to another form?

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
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

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



cheers,
 
T

Tim

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;
}
 

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

Top