Hello,
I have a 2 SQL procedures: the first one returns only a string. The
second one returns only a boolean value.
I created all my connection, parameters and command code.
What is the best way to read the returned string value, in first case,
or the returned boolean value, in second case?
My code is as follows:
1 ' Code that creates the connection, parameters, etc
2 ' ...
3
4 ' Execute the command
5 Dim value As DbDataReader = command.ExecuteReader()
6
7 ' ???? THE CODE I NEED TO KNOW
8
9 value.Close()
10 connection.Close()
Thanks,
Miguel 5 946
"shapper" <md*****@gmail.comwrote in message
news:11**********************@n67g2000cwd.googlegr oups.com...
I have a 2 SQL procedures: the first one returns only a string. The
second one returns only a boolean value.
I created all my connection, parameters and command code.
What is the best way to read the returned string value, in first case,
or the returned boolean value, in second case?
The best ADO.NET method for returning a single value is ExecuteScalar().
Thousands of examples on the web: http://www.google.co.uk/search?sourc...+executescalar
As stated above, the command.executescalar is ideal for this situation, you use it like this
dim bValue as boolean
Connection.open
bValue = command.executescalar
connection.close
If you where reading an integer then
dim intValue as integer
connection.open
intValue = command.executescalar
connection.close
ETC....
---
Posted via DotNetSlackers.com
<Alexander Higginswrote in message
news:Oq**************@TK2MSFTNGP05.phx.gbl...
dim bValue as boolean
bValue = command.executescalar
dim intValue as integer
intValue = command.executescalar
Do you not need to explicitly cast the object datatype returned by
ExecuteScaler() in VB.NET...? You certainly do in C#...
Would the above code compile, even with Option Strict off...?
I did as follows:
Dim html As String = CType(command.ExecuteScalar, String)
Thanks,
Miguel
Mark Rae wrote:
<Alexander Higginswrote in message
news:Oq**************@TK2MSFTNGP05.phx.gbl...
dim bValue as boolean
bValue = command.executescalar
dim intValue as integer
intValue = command.executescalar
Do you not need to explicitly cast the object datatype returned by
ExecuteScaler() in VB.NET...? You certainly do in C#...
Would the above code compile, even with Option Strict off...?
"shapper" <md*****@gmail.comwrote in message
news:11*********************@16g2000cwy.googlegrou ps.com...
Dim html As String = CType(command.ExecuteScalar, String)
Yes, I thought you'd need to do something like that, since ExecuteScalar
returns an object type. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: sedefo |
last post by:
I ran into this Microsoft Patterns & Practices Enterprise Library while i
was researching how i can write a database independent data access layer. In
my company we already use Data Access...
|
by: Jerome |
last post by:
Hi, I'm a bit confused ... when would I rather write an database
application using MS Access and Visual Basic and when (and why) would I
rather write it using Visual Studio .Net?
Is it as easy...
|
by: WalterR |
last post by:
This is my first time here, so there may be earlier relevant threads of
which I am unaware. Though my experience with DB2 is not extensive,
such as it is was under OS/390 or equ. My main...
|
by: Yannick Turgeon |
last post by:
Hello,
We are in the process of examining our current main application. We have to
do some major changes and, in the process, are questionning/validating the
use of MS Access as front-end. The...
|
by: Olav.NET |
last post by:
I am a .NET/C++ developer who is supposed to do some work with Access.
I do not know much about it except for the DB part.
Questions:
*1*
I am looking for INTENSIVE books to get quickly up to...
|
by: Tony Lee |
last post by:
Some time a ago, on this newsgroup the following comments were made in
recommending
good references for Access (2003)
>I used to recommend Dr. Rick Dobson's, "Programming Access <version>" for...
|
by: DaveG |
last post by:
Hi all
I am planning on writing a stock and accounts program for the family
business, I understand this is likely to take close to 2 years to
accomplish. The stock is likely to run into over a...
|
by: B1ackwater |
last post by:
We've fooled around with Access a bit, but only using the
single-user store-bought version. It seems to be a good
database - versatile and infinitely programmable - and
can apparently be used as a...
|
by: Mell via AccessMonster.com |
last post by:
Is there a way to find out where an application was created from?
i.e. - work or home
i.e. - if application sits on a (work) server/network, the IT people know the
application is sitting...
|
by: nihad.nasim |
last post by:
Hi there,
I have a database in Access that I need on the web. The web page
should connect to the database and write records for certain tables
and view records for others. I want to know a...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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: 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: 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: 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...
| |