I am having a weird error and maybe the synatax is different or something. I
use a SQL Stored Proc and pass it one param and get a return to either a
datareader or dataset. The code works fine for a datareader but the dataset
gives me a weird error. I even tried using the same SP with the two code
snippets, one works the other doesn't.
tmpSQL.SQLDB.Op en()
tmpSQL.SQLCmd.C ommandType = CommandType.Sto redProcedure
tmpSQL.SQLCmd.C ommandText = "SP_GETRECORDTE ST"
SqlClient.SqlCo mmandBuilder.De riveParameters( tmpSQL.SQLCmd) <<THIS SHOWS OK
PARAMS IN DEBUG WNDW
tmpSQL.SQLCmd.P arameters(1).Va lue = paramNbr << SEEMS TO IGNORE THIS
Dim DS As DataSet = New DataSet
Dim DA As SqlDataAdapter = New SqlDataAdapter( tmpSQL.SQLCmd.C ommandText,
tmpSQL.SQLDB)
DA.Fill(DS) <<<<<<<<<BOOM says the SP expects param and it was not passed
but this code works....
tmpSQL.SQLDB.Op en()
tmpSQL.SQLCmd.C ommandType = CommandType.Sto redProcedure
tmpSQL.SQLCmd.C ommandText = "SP_GETRECORDAG AIN"
SqlClient.SqlCo mmandBuilder.De riveParameters( tmpSQL.SQLCmd)
tmpSQL.SQLCmd.P arameters(1).Va lue = paramNBR
dReader = tmpSQL.SQLCmd.E xecuteReader()
dReader.Read()
I tried calling the SP_GETRECORDTES T with the datareader code and it works,
so I know the SP is OK..
I need the dataset to work for a datagrid I have, but can't get it to see
the param,
even tried a tmpSQL.SQLCmd.P arameters.Add(" @tmpParam",2) with the DS
code..
did not make any difference..
Any Ideas?
Thanks JOHN 2 1374
Take a look at the constructor for your DataAdapter. You're passing the
CommandText to it. What IS the CommandText? Hint: tmpSQL.SQLCmd.C ommandText = "SP_GETRECORDTE ST"
See any parameters in there?
Instead, assign the Connection to the Command, and use the Command instance
in the constructor for the DataAdapter.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
Everybody picks their nose,
But some people are better at hiding it.
"John" <Jo****@aol.com > wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..I am having a weird error and maybe the synatax is different or something. I use a SQL Stored Proc and pass it one param and get a return to either a datareader or dataset. The code works fine for a datareader but the dataset gives me a weird error. I even tried using the same SP with the two code snippets, one works the other doesn't. tmpSQL.SQLDB.Op en() tmpSQL.SQLCmd.C ommandType = CommandType.Sto redProcedure tmpSQL.SQLCmd.C ommandText = "SP_GETRECORDTE ST" SqlClient.SqlCo mmandBuilder.De riveParameters( tmpSQL.SQLCmd) <<THIS SHOWS OK PARAMS IN DEBUG WNDW tmpSQL.SQLCmd.P arameters(1).Va lue = paramNbr << SEEMS TO IGNORE THIS Dim DS As DataSet = New DataSet Dim DA As SqlDataAdapter = New SqlDataAdapter( tmpSQL.SQLCmd.C ommandText, tmpSQL.SQLDB) DA.Fill(DS) <<<<<<<<<BOOM says the SP expects param and it was not passed
but this code works.... tmpSQL.SQLDB.Op en() tmpSQL.SQLCmd.C ommandType = CommandType.Sto redProcedure tmpSQL.SQLCmd.C ommandText = "SP_GETRECORDAG AIN" SqlClient.SqlCo mmandBuilder.De riveParameters( tmpSQL.SQLCmd) tmpSQL.SQLCmd.P arameters(1).Va lue = paramNBR dReader = tmpSQL.SQLCmd.E xecuteReader() dReader.Read()
I tried calling the SP_GETRECORDTES T with the datareader code and it works, so I know the SP is OK.. I need the dataset to work for a datagrid I have, but can't get it to see the param, even tried a tmpSQL.SQLCmd.P arameters.Add(" @tmpParam",2) with the DS code.. did not make any difference.. Any Ideas? Thanks JOHN
Thanks Kevin... I had to add
DA.SelectComman d.Parameters.Ad d("@tmpParam" , paramNBR)
DA.SelectComman d.CommandType = CommandType.Sto redProcedure
to make it work for the dataadapter but not the datareader, it worked fine
with the original code
"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:eS******** ******@TK2MSFTN GP12.phx.gbl... Take a look at the constructor for your DataAdapter. You're passing the CommandText to it. What IS the CommandText? Hint:
tmpSQL.SQLCmd.C ommandText = "SP_GETRECORDTE ST" See any parameters in there?
Instead, assign the Connection to the Command, and use the Command
instance in the constructor for the DataAdapter.
-- HTH,
Kevin Spencer Microsoft MVP .Net Developer Everybody picks their nose, But some people are better at hiding it.
"John" <Jo****@aol.com > wrote in message news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..I am having a weird error and maybe the synatax is different or
something.I use a SQL Stored Proc and pass it one param and get a return to either a datareader or dataset. The code works fine for a datareader but the dataset gives me a weird error. I even tried using the same SP with the two code snippets, one works the other doesn't. tmpSQL.SQLDB.Op en() tmpSQL.SQLCmd.C ommandType = CommandType.Sto redProcedure tmpSQL.SQLCmd.C ommandText = "SP_GETRECORDTE ST" SqlClient.SqlCo mmandBuilder.De riveParameters( tmpSQL.SQLCmd) <<THIS SHOWS OK PARAMS IN DEBUG WNDW tmpSQL.SQLCmd.P arameters(1).Va lue = paramNbr << SEEMS TO IGNORE THIS Dim DS As DataSet = New DataSet Dim DA As SqlDataAdapter = New SqlDataAdapter( tmpSQL.SQLCmd.C ommandText, tmpSQL.SQLDB) DA.Fill(DS) <<<<<<<<<BOOM says the SP expects param and it was not
passed but this code works.... tmpSQL.SQLDB.Op en() tmpSQL.SQLCmd.C ommandType = CommandType.Sto redProcedure tmpSQL.SQLCmd.C ommandText = "SP_GETRECORDAG AIN" SqlClient.SqlCo mmandBuilder.De riveParameters( tmpSQL.SQLCmd) tmpSQL.SQLCmd.P arameters(1).Va lue = paramNBR dReader = tmpSQL.SQLCmd.E xecuteReader() dReader.Read()
I tried calling the SP_GETRECORDTES T with the datareader code and it works, so I know the SP is OK.. I need the dataset to work for a datagrid I have, but can't get it to
see the param, even tried a tmpSQL.SQLCmd.P arameters.Add(" @tmpParam",2) with the DS code.. did not make any difference.. Any Ideas? Thanks JOHN
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Tony Wright |
last post by:
Hi,
I am having a problem installing an msi for a web site. The error
message I am getting is:
"The specified path 'http://mipdev05/features/Fas2' is unavailable.
The Internet Information Server might not be running or the path
exists and is redirected to another machine. Please check the status
of this virtual directory in the Internet Services Manager."
|
by: Gregory |
last post by:
Hi,
One of the disadvantages of using error handling with error codes
instead of exception handling is that error codes retuned from a
function can be forgotten to check thus leading to
unexpected run-time problems. Exceptions on the other hand can not be
simply ignored.
In order to solve this error codes problem I suggest using error object
instead of error codes.
Each function has to return an error object that stores an error
|
by: deko |
last post by:
I use this convention frequently:
Exit_Here:
Exit Sub
HandleErr:
Select Case Err.Number
Case 3163
Resume Next
Case 3376
Resume Next
|
by: Peter Frost |
last post by:
Please help
I don't know if this is possible but what I would really like to do is
to use On Error Goto to capture the code that is being executed when
an error occurs.
Any help would be much appreciated.
Thanks in advance
|
by: Steve Jorgensen |
last post by:
I'm trying to figure out if there is a way to generate standard error handlers
that "know" if the calling code has an error handler in effect (On Error Goto
<label> or On Error Resume Next) before deciding how to respond. Does anyone
know if this is possible.
| |
by: Squirrel |
last post by:
I have a command button on a subform to delete a record.
The only statement in the subroutine is:
DoCmd.RunCommand acCmdDeleteRecord
The subform's recordsource is "select * from tblVisit order by VisitDt"
I'm getting this error message:
Errno is 2465. Err.description is "Can't find field '|' referred to in your
expression"
|
by: p |
last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also
have Crystal 9 pro on my development machine. The web app runs fine on my
dev machine but am having problems deploying. I created the websetup and
built the MSI, have the bundled version. Copied to webserver and ran
Websetup.msi. Said I had to remove old version, which I did, then reran
WebSetup.msi and keeps giving me this error. "The installer was interrupted...
|
by: Eugene Anthony |
last post by:
One problem with the code bellow is after this code
conn.qDupUser p1,rs
I added:
set rs = nothing
to test the error handling capability.
|
by: hyperpau |
last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding.
I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com).
Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge.
I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
|
by: hyperpau |
last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding.
I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com).
Ergo, I will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge.
I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |