I have the following:
* An OLEDBCommand with command text "SELECT CAMPAIGN,
DAY_OUT WHERE (CAMPAIGN LIKE '@campaign')"
* A DataAdapter that point the select to the above command
* A data grid that I use to display the data
* form load code to populate the controls:
DsCampaign1 = New DataSet
cmdProActiTmp_Sel.Parameters.Item("@Campaign").Val ue = _
Trim(txtcampaign.Text())
DataAdapter1.Fill(DsCampaign1)
DataGrid1.SetDataBinding(DataAdapter1, _
cmdProActiTmp_Sel.ToString)
The issue:
I always get a zero result set, regardless of what the
value of txtcampaign.
TxtCampaign is null when the form first loads but changes
based upon events on the form. How do I get the datagrid
to refresh and use the value? 6 4730
In the absence of a DataBind() statement, I assume you are using Windows
Forms. If this is the case, the bound data will be reflected in the DataGrid
each time it is changed.
Your problem, looks as if its more related to the data you are selected. For
a test, try hard coding the select statement to retreive known ' or all '
values and then take it from there.
HTH
--
OHM ( Terry Burns )
. . . One-Handed-Man . . .
Time flies when you don't know what you're doing
"Jack" <Ja**@sonomaenterprises.com> wrote in message
news:25*****************************@phx.gbl... I have the following:
* An OLEDBCommand with command text "SELECT CAMPAIGN, DAY_OUT WHERE (CAMPAIGN LIKE '@campaign')" * A DataAdapter that point the select to the above command * A data grid that I use to display the data * form load code to populate the controls: DsCampaign1 = New DataSet cmdProActiTmp_Sel.Parameters.Item("@Campaign").Val ue = _ Trim(txtcampaign.Text()) DataAdapter1.Fill(DsCampaign1) DataGrid1.SetDataBinding(DataAdapter1, _ cmdProActiTmp_Sel.ToString)
The issue:
I always get a zero result set, regardless of what the value of txtcampaign. TxtCampaign is null when the form first loads but changes based upon events on the form. How do I get the datagrid to refresh and use the value?
I removed the where clause and it returns all the records
with out error.
This is a windows application (not web), it a windows form
with a datagrid on the form.
I am sure once I understand the details of data access
in .NET it will be an improvement from V6, but right now
this is sooo frustrating. I spend hours getting basic
things working that took minutes in v6....... -----Original Message----- In the absence of a DataBind() statement, I assume you
are using WindowsForms. If this is the case, the bound data will be
reflected in the DataGrideach time it is changed.
Your problem, looks as if its more related to the data
you are selected. Fora test, try hard coding the select statement to retreive
known ' or all 'values and then take it from there.
HTH
--
OHM ( Terry Burns ) . . . One-Handed-Man . . .
Time flies when you don't know what you're doing
"Jack" <Ja**@sonomaenterprises.com> wrote in message news:25*****************************@phx.gbl... I have the following:
* An OLEDBCommand with command text "SELECT CAMPAIGN, DAY_OUT WHERE (CAMPAIGN LIKE '@campaign')" * A DataAdapter that point the select to the above
command * A data grid that I use to display the data * form load code to populate the controls: DsCampaign1 = New DataSet cmdProActiTmp_Sel.Parameters.Item("@Campaign").Val ue = _ Trim(txtcampaign.Text()) DataAdapter1.Fill(DsCampaign1) DataGrid1.SetDataBinding(DataAdapter1, _ cmdProActiTmp_Sel.ToString)
The issue:
I always get a zero result set, regardless of what the value of txtcampaign. TxtCampaign is null when the form first loads but
changes based upon events on the form. How do I get the
datagrid to refresh and use the value?
.
OK, I think I see what your trying to do then.
So, on the event for textChanged or under a button
Dim SQLString = "SELECT . .. . . . . . .
DataAdapter.Clear()
DataAdapter.Fill( DataSet, TableName )
You dont need to rebind it.
Then is should be a simple matter of tuning your select statement.
--
OHM ( Terry Burns )
. . . One-Handed-Man . . .
Time flies when you don't know what you're doing
"jack" <ja**@sonomaenterprises.com> wrote in message
news:25*****************************@phx.gbl... I removed the where clause and it returns all the records with out error.
This is a windows application (not web), it a windows form with a datagrid on the form.
I am sure once I understand the details of data access in .NET it will be an improvement from V6, but right now this is sooo frustrating. I spend hours getting basic things working that took minutes in v6.......
-----Original Message----- In the absence of a DataBind() statement, I assume you are using WindowsForms. If this is the case, the bound data will be reflected in the DataGrideach time it is changed.
Your problem, looks as if its more related to the data you are selected. Fora test, try hard coding the select statement to retreive known ' or all 'values and then take it from there.
HTH
--
OHM ( Terry Burns ) . . . One-Handed-Man . . .
Time flies when you don't know what you're doing
"Jack" <Ja**@sonomaenterprises.com> wrote in message news:25*****************************@phx.gbl... I have the following:
* An OLEDBCommand with command text "SELECT CAMPAIGN, DAY_OUT WHERE (CAMPAIGN LIKE '@campaign')" * A DataAdapter that point the select to the above command * A data grid that I use to display the data * form load code to populate the controls: DsCampaign1 = New DataSet cmdProActiTmp_Sel.Parameters.Item("@Campaign").Val ue = _ Trim(txtcampaign.Text()) DataAdapter1.Fill(DsCampaign1) DataGrid1.SetDataBinding(DataAdapter1, _ cmdProActiTmp_Sel.ToString)
The issue:
I always get a zero result set, regardless of what the value of txtcampaign. TxtCampaign is null when the form first loads but changes based upon events on the form. How do I get the datagrid to refresh and use the value?
.
Split the problem into two parts:
- figure out how to get the grid to change when the query changes (see the
post by OHM)
- verify that the query is changing with the appropriate parameter
"Jack" <Ja**@sonomaenterprises.com> wrote in message
news:25*****************************@phx.gbl... I have the following:
* An OLEDBCommand with command text "SELECT CAMPAIGN, DAY_OUT WHERE (CAMPAIGN LIKE '@campaign')" * A DataAdapter that point the select to the above command * A data grid that I use to display the data * form load code to populate the controls: DsCampaign1 = New DataSet cmdProActiTmp_Sel.Parameters.Item("@Campaign").Val ue = _ Trim(txtcampaign.Text()) DataAdapter1.Fill(DsCampaign1) DataGrid1.SetDataBinding(DataAdapter1, _ cmdProActiTmp_Sel.ToString)
The issue:
I always get a zero result set, regardless of what the value of txtcampaign. TxtCampaign is null when the form first loads but changes based upon events on the form. How do I get the datagrid to refresh and use the value?
The one thing that I do not understand is how the
parameters are used. Do I just build the sql stmt
with '"where campaign = " & trim(textbox.text)' and use
that in place of the table name and not worry about the
parameters. -----Original Message----- OK, I think I see what your trying to do then.
So, on the event for textChanged or under a button
Dim SQLString = "SELECT . .. . . . . . . DataAdapter.Clear() DataAdapter.Fill( DataSet, TableName )
You dont need to rebind it.
Then is should be a simple matter of tuning your select
statement.
--
OHM ( Terry Burns ) . . . One-Handed-Man . . .
Time flies when you don't know what you're doing
"jack" <ja**@sonomaenterprises.com> wrote in message news:25*****************************@phx.gbl... I removed the where clause and it returns all the
records with out error.
This is a windows application (not web), it a windows
form with a datagrid on the form.
I am sure once I understand the details of data access in .NET it will be an improvement from V6, but right now this is sooo frustrating. I spend hours getting basic things working that took minutes in v6.......
>-----Original Message----- >In the absence of a DataBind() statement, I assume you are using Windows >Forms. If this is the case, the bound data will be reflected in the DataGrid >each time it is changed. > >Your problem, looks as if its more related to the data you are selected. For >a test, try hard coding the select statement to
retreive known ' or all ' >values and then take it from there. > >HTH > >-- > >OHM ( Terry Burns ) > . . . One-Handed-Man . . . > >Time flies when you don't know what you're doing > >"Jack" <Ja**@sonomaenterprises.com> wrote in message >news:25*****************************@phx.gbl... >> I have the following: >> >> * An OLEDBCommand with command text "SELECT CAMPAIGN, >> DAY_OUT WHERE (CAMPAIGN LIKE '@campaign')" >> * A DataAdapter that point the select to the above command >> * A data grid that I use to display the data >> * form load code to populate the controls: >> DsCampaign1 = New DataSet >> cmdProActiTmp_Sel.Parameters.Item("@Campaign").Val ue
= _ >> Trim(txtcampaign.Text()) >> DataAdapter1.Fill(DsCampaign1) >> DataGrid1.SetDataBinding(DataAdapter1, _ >> cmdProActiTmp_Sel.ToString) >> >> The issue: >> >> I always get a zero result set, regardless of what
the >> value of txtcampaign. >> TxtCampaign is null when the form first loads but changes >> based upon events on the form. How do I get the datagrid >> to refresh and use the value? > > >. >
.
Hi Jack,
I can not completly see how you use the commands, can you try this sample I
made for you?
\\\
cmd.CommandText = "Select * from tblUsers where (UserId = @UserId)"
Dim myparam As New OleDb.OleDbParameter("@UserId", _
OleDb.OleDbType.Integer)
myparam.Value = 1
cmd.Parameters.Add(myparam)
///
I hope this helps?
Cor The one thing that I do not understand is how the parameters are used. Do I just build the sql stmt with '"where campaign = " & trim(textbox.text)' and use that in place of the table name and not worry about the parameters. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Toby |
last post by:
I've a DataAdapter with:
SELECT ID, Employee, , Period_End_Date, Job, Description, Exported,
Units, Cost_Code, Category, Class, Chargeout_Level, PayID, Rate
FROM tblTimeEntry
WHERE ...
|
by: randy |
last post by:
Hello all,
I have a DataTable which I am building column by column and adding rows
after each new column. The DataTable columns match the columns in my
database table. I'm building the...
|
by: Joe Fetters via .NET 247 |
last post by:
Have googled and read the VS.NET documentation can't seem to getthe answer to the following.
Environment:
Framework 1.1
VB.NET WinForm
Access database
Using all automagic tools (DataAdapter...
|
by: James |
last post by:
I have an sp with paramaters like this:
ALTER PROCEDURE dbo.SomeProc
(
@SortBy varchar(50) = NULL
@ShowComplete bit = 0
@StaffID int = NULL
)
AS
DECLARE @SQL varchar(2500)
SET @SQL =
|
by: John Smith |
last post by:
i dont understand how to use `em
all those @id ...
what they have to do with a datagrid bound to a dataset filled by an adapter
TIA
| |
by: Ed |
last post by:
Hi,
I want to load data to a table in Sql Server from a
dataset table in my vb.net app using a dataAdapter. I
know how to do this as follows (my question is to see if I
can reduce the amount...
|
by: Zorpiedoman |
last post by:
I keep getting a concurrency exception the second time I make a change and
attempt to update a dataadapter. It appears this is by design, so there must
be something I can do to avoid it.
...
|
by: Rich |
last post by:
Dim da As New SqlDataAdapter("Select * from tbl1", conn)
dim tblx As New DataTable
da.Fill(tblx) '--works OK up to this point
da.UpdateCommand = New SqlCommand
da.UpdateCommand.Connection =...
|
by: Rich |
last post by:
What is the diffeence bewtween a dataAdapter.InsertCommand and
dataAdapter.SelectCommand (and dataAdapter.UpdateCommand for that matter)?
Dim da As SqlDataAdapter
conn.Open
da.SelectCommand =...
|
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,...
|
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,...
| |
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...
|
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...
|
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: 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,...
|
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...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |