Hi,
I try to construct a SQL code for a view to select a specific data
from a table, this query take the value of the filter from a text box
in a visual basic 6.0 form. my problem is when i DECLARE the variable
@AMP receive a error message that said "The Declare cursor SQL
construct or statement is not supported." What i do wrong? Please help
me. i attach the code.
DECLARE @AMP int;
SELECT Size, Type, Ampacity, Isulation, Temperature, Material
FROM dbo.Conductors
WHERE (Isulation LIKE 'THHN') AND (Material LIKE 'COPPER') AND
(Ampacity = @AMP)
Thanks!!! 2 13458 ju**********@gm ail.com wrote:
Hi,
I try to construct a SQL code for a view to select a specific data
from a table, this query take the value of the filter from a text box
in a visual basic 6.0 form. my problem is when i DECLARE the variable
@AMP receive a error message that said "The Declare cursor SQL
construct or statement is not supported." What i do wrong? Please help
me. i attach the code.
DECLARE @AMP int;
SELECT Size, Type, Ampacity, Isulation, Temperature, Material
FROM dbo.Conductors
WHERE (Isulation LIKE 'THHN') AND (Material LIKE 'COPPER') AND
(Ampacity = @AMP)
Not sure what you mean by view, is it view as in "create view ..."? If
it is I would advise against creating ddl objects on the fly. If this is
just a query, I would suggest that you use a prepared statement. I dont
see why you would have to declare anything for this particilar query.
Using a pseudo syntax:
ps = new prepared_statem ent(
"SELECT Size, Type, Ampacity, Isulation, Temperature, Material
FROM dbo.Conductors
WHERE Isulation = ?
AND Material = ?
AND Ampacity = ?")
ps.setparameter (1, 'THHN')
ps.setparameter (2, 'COPPER')
....
ps.executequery ()
I dont know VB but I assume it has something atleast similar to a
prepared stmt
HTH
/Lennart ju**********@gm ail.com wrote:
Hi,
I try to construct a SQL code for a view to select a specific data
from a table, this query take the value of the filter from a text box
in a visual basic 6.0 form. my problem is when i DECLARE the variable
@AMP receive a error message that said "The Declare cursor SQL
construct or statement is not supported." What i do wrong? Please help
me. i attach the code.
DECLARE @AMP int;
SELECT Size, Type, Ampacity, Isulation, Temperature, Material
FROM dbo.Conductors
WHERE (Isulation LIKE 'THHN') AND (Material LIKE 'COPPER') AND
(Ampacity = @AMP)
Have a look at the DECLARE CURSOR syntax: http://tinyurl.com/2mnmgf
It would be something like:
DECLARE @AMP INT;
DECLARE cursName CURSOR FOR SELECT ... FROM ... WHERE ...;
--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: sci |
last post by:
Could someone help me by answering the questions below?
What's a cursor?
What's difference between Query and View?
Is a RecordSet just part of a table? Can it be part of a query of view?
If the content in a table changed, is it necessary for a old recordset to
renew itself by do "Requery()"?
Thanks for your help!
|
by: Yusuf INCEKARA |
last post by:
I have a stored procedure :
CREATE PROCEDURE STP_GETSTORELIST @RETCUR CURSOR VARYING OUTPUT
AS
set @RETCUR = CURSOR
FORWARD_ONLY STATIC FOR
SELECT ID,STORE_NAME FROM T_INF_STORE
ORDER BY STORE_NAME
OPEN @RETCUR
|
by: Mike Hofer |
last post by:
While I'd toyed with C, C++, and Java over the last 20 years or so, my
principal language has been BASIC, QBASIC, then Visual Basic, and
finally Visual Basic .NET. But lately, I've been using C# and I
absolutely *love* it. It makes me think more about what I'm doing it
before I just spew code into the editor. I'm writing better code than
ever.
The only thing so far that I don't like about it is the switch
construct. I can't do this:
|
by: Lance Geeck |
last post by:
I have many items that I lifted off from Microsoft's website several years
ago. These samples were in VB6.
I now want to convert an application to VB.NET. I am getting an error
that says "As Any is not supported in a declare statement" during the
automated
Conversion process.
Some examples of this are:
Private Declare Sub CopyMem Lib "kernel32" Alias "RtlMoveMemory"(ByRef
|
by: peppi911 |
last post by:
Hi,
is it possible to create a cursor from a dynamic string?
Like:
DECLARE @cursor nvarchar(1000)
SET @cursor = N'SELECT product.product_id
FROM product WHERE fund_amt > 0'
DECLARE ic_uv_cursor CURSOR FOR @cursor
| |
by: John Bailo |
last post by:
I created a sproc with 3 input parameters and one output parameter.
I want to test it in the "Run SQL Scripts" app of Navigator.
I wrote this code:
DECLARE RTNDATE CHAR(10) DEFAULT '';
CALL MANLIB.MANDATCL('ADD','20060101','1',RTNDATE)
SELECT MYVAR;
|
by: scoonie999 |
last post by:
I'm having a problem that I can't seem to find any solution for online.
I'm using a cursor in a cobol program to fetch some data. I know for a
fact that the select should return 2 rows. The fetch works as I would
expect it to on the 2 rows, but then when I do my next fetch, the
program ends abnormally.
My next step is to check for sqlcode 100, as I would expect it to be,
but my program never even gets to this step.
|
by: invy |
last post by:
Hi,
I'm experiencing a problem while declaring scroll cursor. I'm
using Embeded SQL with C. my code is given below.
#ifdef SQLSRVR_RDBMS
EXEC SQL DECLARE CUR_DWNLD SCROLL CURSOR FOR SCURS;
EXEC SQL PREPARE SCURS FROM :S_QRY;
#endif
|
by: rkandas |
last post by:
Order by based on input
Select col1, col2, col3
from table 1
order by col1 <ASC/DESC>, col2 <ASC/DESC>, col3 <ASC/DESC>
The sort order for col1, col2, col3 are parameters to the program. Can anyone explain how to parametrize the sort order without using a dynamic sql.
DECLARE cursor clause based on parameter
DECLARE CURSOR csr1 <SCROLL/NOSCROLL> CURSOR
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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: 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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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: 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...
| |