473,466 Members | 1,331 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Command Execution

I think I'm missing an execute command here. Please help.

Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Me.Label1.Text = ListBox1.SelectedItem.Value()
Me.DataGrid1.Visible = False
Me.MySqlCommand2.CommandText = "select * from filename where
Customer_id=" + ListBox1.SelectedItem.Value
Me.MySqlDataTable2.SelectCommand = Me.MySqlCommand2
Me.DataSet11.Reset()
Me.MySqlDataAdapter2.Fill(DataSet11)
DataGrid1.DataSource = DataSet11
DataGrid1.DataBind()
Me.DataGrid1.Visible = True
End Sub
Nov 19 '05 #1
5 1470
..NET 2.0, I assume?

Since you are not using one of the new DataSource objects, I would venture
that you need to open the connection before the Fill() and then close it.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
"Niggy" wrote:
I think I'm missing an execute command here. Please help.

Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Me.Label1.Text = ListBox1.SelectedItem.Value()
Me.DataGrid1.Visible = False
Me.MySqlCommand2.CommandText = "select * from filename where
Customer_id=" + ListBox1.SelectedItem.Value
Me.MySqlDataTable2.SelectCommand = Me.MySqlCommand2
Me.DataSet11.Reset()
Me.MySqlDataAdapter2.Fill(DataSet11)
DataGrid1.DataSource = DataSet11
DataGrid1.DataBind()
Me.DataGrid1.Visible = True
End Sub

Nov 19 '05 #2
Thanks. I've done as you suggest, however, I still need to execute the
command text. How do I do this within the context of my existing code?

"Cowboy (Gregory A. Beamer) - MVP" wrote:
.NET 2.0, I assume?

Since you are not using one of the new DataSource objects, I would venture
that you need to open the connection before the Fill() and then close it.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
"Niggy" wrote:
I think I'm missing an execute command here. Please help.

Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Me.Label1.Text = ListBox1.SelectedItem.Value()
Me.DataGrid1.Visible = False
Me.MySqlCommand2.CommandText = "select * from filename where
Customer_id=" + ListBox1.SelectedItem.Value
Me.MySqlDataTable2.SelectCommand = Me.MySqlCommand2
Me.DataSet11.Reset()
Me.MySqlDataAdapter2.Fill(DataSet11)
DataGrid1.DataSource = DataSet11
DataGrid1.DataBind()
Me.DataGrid1.Visible = True
End Sub

Nov 19 '05 #3
i guess you are missing a connection here or not using it..
check out this article
http://www.developerfusion.com/show/4278/1/
--
The best
srini
http://www.expertszone.com
"Niggy" wrote:
I think I'm missing an execute command here. Please help.

Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Me.Label1.Text = ListBox1.SelectedItem.Value()
Me.DataGrid1.Visible = False
Me.MySqlCommand2.CommandText = "select * from filename where
Customer_id=" + ListBox1.SelectedItem.Value
Me.MySqlDataTable2.SelectCommand = Me.MySqlCommand2
Me.DataSet11.Reset()
Me.MySqlDataAdapter2.Fill(DataSet11)
DataGrid1.DataSource = DataSet11
DataGrid1.DataBind()
Me.DataGrid1.Visible = True
End Sub

Nov 19 '05 #4
My code so far is:

Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Me.Label1.Text = ListBox1.SelectedItem.Value()
Me.DataGrid1.Visible = False
Me.MySqlCommand2.CommandText = "select * from filename where
Customer_id=" + ListBox1.SelectedItem.Value
Me.MySqlDataTable2.SelectCommand = Me.MySqlCommand2
Me.DataSet11.Reset()
Me.MySqlDataAdapter2.Fill(DataSet11)
DataGrid1.DataSource = DataSet11
' DataGrid1.DataBind()
Me.DataGrid1.Visible = True
End Sub

But my datagrid remains the same. Any ideas?

"srini" wrote:
i guess you are missing a connection here or not using it..
check out this article
http://www.developerfusion.com/show/4278/1/
--
The best
srini
http://www.expertszone.com
"Niggy" wrote:
I think I'm missing an execute command here. Please help.

Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Me.Label1.Text = ListBox1.SelectedItem.Value()
Me.DataGrid1.Visible = False
Me.MySqlCommand2.CommandText = "select * from filename where
Customer_id=" + ListBox1.SelectedItem.Value
Me.MySqlDataTable2.SelectCommand = Me.MySqlCommand2
Me.DataSet11.Reset()
Me.MySqlDataAdapter2.Fill(DataSet11)
DataGrid1.DataSource = DataSet11
DataGrid1.DataBind()
Me.DataGrid1.Visible = True
End Sub

Nov 19 '05 #5
The correct code is:

Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Dim Cust_id As String
Cust_id = "select * from filename where Customer_id=" +
ListBox1.SelectedItem.Value()
Me.DataGrid1.Visible = False
Me.MySqlConnection1.Open()
Me.MySqlCommand1.CommandText = Cust_id
Me.MySqlDataTable1.SelectCommand = Me.MySqlCommand1
Me.MySqlDataAdapter1.Fill(DataSet11)
Me.MySqlConnection1.Close()
DataGrid1.DataSource = DataSet11
DataGrid1.DataBind()
Me.DataGrid1.Visible = True
End Sub

"Niggy" wrote:
I think I'm missing an execute command here. Please help.

Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Me.Label1.Text = ListBox1.SelectedItem.Value()
Me.DataGrid1.Visible = False
Me.MySqlCommand2.CommandText = "select * from filename where
Customer_id=" + ListBox1.SelectedItem.Value
Me.MySqlDataTable2.SelectCommand = Me.MySqlCommand2
Me.DataSet11.Reset()
Me.MySqlDataAdapter2.Fill(DataSet11)
DataGrid1.DataSource = DataSet11
DataGrid1.DataBind()
Me.DataGrid1.Visible = True
End Sub

Nov 19 '05 #6

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

Similar topics

1
by: wai yung | last post by:
Hi all, I need to execute a command, a method of an object, which will run for an uncertain amount of time. It could be a long time. So what I want to do is if the command does not return , say ,...
1
by: TEK | last post by:
Hello I'm wondering if anyone out there might give some input/suggestions/viewpoints around the Command pattern. In my case, the number one priority for using the pattern is undo support. Some...
3
by: Nathan Sokalski | last post by:
I want to create a procedure in ASP.NET to run the "SET DEFINE OFF" command in an Oracle database. I tried the following: Public Shared Sub SetDefineOff() Dim myconnection As New...
8
by: Peter A. Schott | last post by:
Per subject - I realize I can copy/paste a line at a time into an interactive session when I'm trying to debug, but was wondering if there is any tool out there that allows me to copy sections of...
2
by: Mark | last post by:
Hi all, a quick ADO.NET question in regards to the command object. What are the advantages (if any) of specifying command parameters when executing a stored procedure over just calling the stored...
4
by: G. Miller | last post by:
Hey, I'm trying to automate an import routine by using the shell command to call a batch file that will run a vendor export utility before continuing with the import. The problem is that...
0
by: Tharpa Roberts | last post by:
Under Visual C++ 6.0, if you made a command-line program, it would stay open after execution, and then you would press any key to close it. Under Visual Studio 2005, if you make a C++ command...
1
by: klmishraa79 | last post by:
i want to know how i can put a time delay between two command execution...i.e. after first command of programm the second command should execute after some fixed delay......i want to use time delay...
2
by: preethi303 | last post by:
Hi, I have a program that displays a status message using a label and during the execution of a command that takes a couple of seconds, I want the label to display the message ("Configuring,...
5
by: dsky | last post by:
I have a program in C#.NET which runs in both GUI and command line mode. When I pass the command line arguments to the executable like: C:\>myprogram.exe -a file.txt the program is invoked,...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.