473,395 Members | 1,692 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to pass SQL Command and Parameters to another form?

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.cmmSQLUpdateSaleRe view);

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
Nov 17 '05 #1
3 1833
Hi,

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

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Tim" <ti*@home.com> wrote in message
news:tT*******************@news20.bellglobal.com.. .
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.cmmSQLUpdateSaleRe view);

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

Nov 17 '05 #2
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.cmmSQLUpdateSaleRe view);
this.Cursor = Cursors.Default;
if (fSaleItems.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
{
itemSelect = true;
this.EnableDisableNextButton();
this.btnReviewItems.Enabled = true;
}

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:ef****************@TK2MSFTNGP09.phx.gbl...
Hi,

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

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Tim" <ti*@home.com> wrote in message
news:tT*******************@news20.bellglobal.com.. .
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.cmmSQLUpdateSaleRe view);

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


Nov 17 '05 #3
Ron
Pass the command as an argument in the Form's constructor. That should work OK.

"Tim" wrote:
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.cmmSQLUpdateSaleRe view);
this.Cursor = Cursors.Default;
if (fSaleItems.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
{
itemSelect = true;
this.EnableDisableNextButton();
this.btnReviewItems.Enabled = true;
}

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:ef****************@TK2MSFTNGP09.phx.gbl...
Hi,

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

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Tim" <ti*@home.com> wrote in message
news:tT*******************@news20.bellglobal.com.. .
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.cmmSQLUpdateSaleRe view);

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



Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: qazmlp | last post by:
void func() { // Is it by anyway possible to read the value of the first command line parameter i.e. argv here ? } int main() { func() ; // No command line arguments are passed to func(). }
3
by: Lyn | last post by:
Hi, I have been experiencing a problem passing a LIKE statement in the WHERE argument of a DoCmd.Openform statement. I have posted that issue separately. However, in an attempt to work around...
7
by: Zlatko Matić | last post by:
Let's assume that we have a database on some SQL server (let it be MS SQL Server) and that we want to execute some parameterized query as a pass.through query. How can we pass parameters to the...
0
by: Zlatko Matić | last post by:
Hi everybody! Recently I was struggling with client/server issues in MS Access/PostgreSQL combination. Although Access is intuitive and easy to use desktop database solution, many problems...
3
by: Joseph Lu | last post by:
Hi, all I have a stored procedure created in SQL Server like the following lines. // stored proceudre code starts here CREATE PROCEDURE sp_insertdata @strdata varchar(250) , @rsult BIT...
1
by: Mayhem05 | last post by:
I have an Access 2003 database that I need to write some VBA code for to populate a table. The table is based on a query I have built in Access queries. Right now I have 2 parameters that are...
3
by: epfmy | last post by:
Hi I want to ask... A report is using a query as record source. That query has parameters and . A command button in a form open that report. That form contains 2 textbox for date. How...
24
by: =?Utf-8?B?U3dhcHB5?= | last post by:
Can anyone suggest me to pass more parameters other than two parameter for events like the following? Event: Onbutton_click(object sender, EventArgs e)" Event handler: button.Click += new...
12
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms....
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.