I am trying to get a parameter passed from one page to another in a
QueryString to get inserted into the select statement on the page that is
getting called. If I hard code in a value everything works, but I can't
figure out how to get it to pass in as a parameter. Here is what I have.
The parameter section doesn't work though.
OleDbConnection conn = new
OleDbConnection(ConfigurationSettings.AppSettings["ReportRequestConnectionSt
ring"]);
OleDbDataAdapter da = new OleDbDataAdapter(sqlQuery, conn);
// OleDbParameter myParm = da.SelectCommand.Parameters.Add(ppRequestID,
OleDbType.Numeric, 8, ppRequestID);
conn.Open();
DataSet ds = new DataSet();
da.Fill(ds, "Report");
lblFirstName.Text = (string)ds.Tables[0].Rows[0]["created_by"];
conn.Close();
} 3 2664
How have you defined ppRequestID?
Brian Conway wrote: I am trying to get a parameter passed from one page to another in a QueryString to get inserted into the select statement on the page that is getting called. If I hard code in a value everything works, but I can't figure out how to get it to pass in as a parameter. Here is what I have. The parameter section doesn't work though.
OleDbConnection conn = new OleDbConnection(ConfigurationSettings.AppSettings["ReportRequestConnectionSt ring"]);
OleDbDataAdapter da = new OleDbDataAdapter(sqlQuery, conn);
// OleDbParameter myParm = da.SelectCommand.Parameters.Add(ppRequestID, OleDbType.Numeric, 8, ppRequestID);
conn.Open();
DataSet ds = new DataSet();
da.Fill(ds, "Report");
lblFirstName.Text = (string)ds.Tables[0].Rows[0]["created_by"];
conn.Close();
}
Brian Conway <Br**********@qwest.com> wrote: I am trying to get a parameter passed from one page to another in a QueryString to get inserted into the select statement on the page that is getting called. If I hard code in a value everything works, but I can't figure out how to get it to pass in as a parameter. Here is what I have. The parameter section doesn't work though.
OleDbConnection conn = new OleDbConnection(ConfigurationSettings.AppSettings["ReportRequestConnectionSt ring"]);
OleDbDataAdapter da = new OleDbDataAdapter(sqlQuery, conn);
// OleDbParameter myParm = da.SelectCommand.Parameters.Add(ppRequestID, OleDbType.Numeric, 8, ppRequestID);
conn.Open();
DataSet ds = new DataSet();
da.Fill(ds, "Report");
lblFirstName.Text = (string)ds.Tables[0].Rows[0]["created_by"];
conn.Close();
}
What value are you trying to set for the parameter? If it's
ppRequestID, then you should be aware that the method you're calling is
using that as the *name* of the parameter, not the value. Use the Value
property of the parameter to set its value.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
I figured it out I used
da.SelectCommand.Parameters.Add(ppRequestID, OleDbType.Numeric, 8).Value =
ppRequestID;
and this worked fine.
"Brian Conway" <Br**********@qwest.com> wrote in message
news:uL**************@TK2MSFTNGP11.phx.gbl... I am trying to get a parameter passed from one page to another in a QueryString to get inserted into the select statement on the page that is getting called. If I hard code in a value everything works, but I can't figure out how to get it to pass in as a parameter. Here is what I have. The parameter section doesn't work though.
OleDbConnection conn = new
OleDbConnection(ConfigurationSettings.AppSettings["ReportRequestConnectionSt ring"]);
OleDbDataAdapter da = new OleDbDataAdapter(sqlQuery, conn);
// OleDbParameter myParm = da.SelectCommand.Parameters.Add(ppRequestID, OleDbType.Numeric, 8, ppRequestID);
conn.Open();
DataSet ds = new DataSet();
da.Fill(ds, "Report");
lblFirstName.Text = (string)ds.Tables[0].Rows[0]["created_by"];
conn.Close();
}
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: zlatko |
last post by:
There is a form in an Access Project (.adp, Access front end with SQL
Server) for entering data into a table for temporary storing. Then, by
clicking a botton, several action stored procedures...
|
by: douglascfast |
last post by:
Anyone,
Is this possible?
I am connecting to a TeraData server via MS SQL 8.0 using the OpenQuery
statement. I need to pass a list of ever-changing deal numbers My
list of numbers are...
|
by: Harolds |
last post by:
The code below worked in VS 2003 & dotnet framework 1.1 but now in VS 2005
the pmID is evaluated to "" instead of what the value is set to:
....
xmlItems.Document = pmXML
// Add the pmID...
|
by: dharmadam |
last post by:
Is it possible to pass a column name or the order of the column name
in the DB2 table table function. For example, I want to update the
address of a person by passing one of the address column name...
|
by: Zlatko Matić |
last post by:
Hello.
I know how to call a parameterized stored procedure by using ADODB command
object and parameters,
but how can I execute the same query using adCmdText instead of
adCmdStoredProc?
Namely...
|
by: owengoodhew |
last post by:
Guys I need your help/Advice...
In my Access Database I have a query (lets say qry1) and in this query
i have 2 fields for start and end date, which is provided by 2 Get
functions.
also i...
|
by: glenn |
last post by:
Hi folks,
The problem I have is that a query string works if hard-coded but
if I pass a variable to it, it does not work as shown here.
This works:
querystring="SELECT * FROM USERS WHERE...
|
by: gordon |
last post by:
Hi
I have a text boxe that passes its contents to a select command that is used
in a where statement - - - WHERE name like '%" + input + "%'.
I am concerned that it may be possible for...
|
by: kennthompson |
last post by:
Trouble passing mysql table name in php. If I use an existing table
name already defined everything works fine as the following script
illustrates.
<?php
function fms_get_info()
{
$result =...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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: 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...
|
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: 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...
| |