473,394 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

stored procedure + vb.net sqlreader problem

I got 2 sql statment to check whether the account code exsist in one of
their tables. and then want to get the counter.
Thanks a lot.
-----my vb.net syntax-----
cmdSearch.Parameters.Add(New SqlParameter("@acctcode",
SqlDbType.VarChar, 20)).Value = Me.txtAcctCode.Text.Trim
cmdSearch.Parameters.Add(New SqlParameter("@countno",
SqlDbType.Int))
cmdSearch.Parameters("@countno").Direction =
ParameterDirection.Output

Try
Dim drCntrId As SqlDataReader =
cmdSearch.ExecuteReader(CommandBehavior.SingleRow)
While drCntrId.Read
intCount = drCntrId.Item("countno") <-- It seems do nothing
and I can get the countno
End While
DECLARE @countno_gljn as int
DECLARE @countno_arinv as int
/*GLJNHEADER*/
select @countno_gljn = count(VD.acctcode)
from gljnheader vh,gljndetail vd
where vh.voucherno = vd.voucherno and vh.validsw = 1 and rtrim(vd.acctcode)
= rtrim(@acctcode)

/*ARINVHEADER*/

select @countno_arinv = count(VD.acctcode)
from arinvinfo vh,arinvchg vd
where vh.invno = vd.invno and vh.validsw = 1 and rtrim(vd.acctcode) =
rtrim(@acctcode)

SELECT @countno = @countno_gljn + @countno_arinv

RETURN @countno
go
Nov 21 '05 #1
1 2179
I solve my problem by....

cmdSearch.ExecuteNonQuery()
If IsDBNull(cmdSearch.Parameters.Item("@countno").Val ue()) Then
intCount = 0
Else
intCount = (cmdSearch.Parameters.Item("@countno").Value())
End If
cmdSearch.Dispose()
Sorry for my nevrous.
"Agnes" <ag***@dynamictech.com.hk> ¼¶¼g©ó¶l¥ó·s»D:OJ**************@TK2MSFTNGP10.phx.g bl...
I got 2 sql statment to check whether the account code exsist in one of
their tables. and then want to get the counter.
Thanks a lot.
-----my vb.net syntax-----
cmdSearch.Parameters.Add(New SqlParameter("@acctcode",
SqlDbType.VarChar, 20)).Value = Me.txtAcctCode.Text.Trim
cmdSearch.Parameters.Add(New SqlParameter("@countno",
SqlDbType.Int))
cmdSearch.Parameters("@countno").Direction =
ParameterDirection.Output

Try
Dim drCntrId As SqlDataReader =
cmdSearch.ExecuteReader(CommandBehavior.SingleRow)
While drCntrId.Read
intCount = drCntrId.Item("countno") <-- It seems do nothing
and I can get the countno
End While
DECLARE @countno_gljn as int
DECLARE @countno_arinv as int
/*GLJNHEADER*/
select @countno_gljn = count(VD.acctcode)
from gljnheader vh,gljndetail vd
where vh.voucherno = vd.voucherno and vh.validsw = 1 and
rtrim(vd.acctcode)
= rtrim(@acctcode)

/*ARINVHEADER*/

select @countno_arinv = count(VD.acctcode)
from arinvinfo vh,arinvchg vd
where vh.invno = vd.invno and vh.validsw = 1 and rtrim(vd.acctcode) =
rtrim(@acctcode)

SELECT @countno = @countno_gljn + @countno_arinv

RETURN @countno
go

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Michael Trosen | last post by:
Hi Everyone, I hope someone can help, I'm pretty new to pro*c programming. I have the following application setup: a pro*c program calls a stored procedure and recieves a cursor back: the...
3
by: Rhino | last post by:
I've spent the last couple of hours trying to figure out how to debug a Java stored procedure and am just going in circles. The last straw came when I got "Cannot open input stream for default"...
2
by: Kent Lewandowski | last post by:
hi all, Recently I wrote some stored procedures using java jdbc code (admittedly my first stab) and then tried to implement the same within java packages (for code reuse). I encountered...
6
by: Wojciech Wendrychowicz | last post by:
Hello to All, I'm trying to retrieve records from AS/400 in an VBA application. So, I've made an RPG program, then a stored procedure wchich calls that RPG program, and finally some VBA code to...
2
by: Scott Natwick | last post by:
Hi, Is there a way to obtain the return code from a stored procedure? Here is what I have so far. The procedure executes, but I'm not able to find the return code from the procedure. ...
0
by: Chris Morse | last post by:
Hi, Following is a function I wrote to export the rows of an arbitrary table. It's not complete yet, in that it currently does not output to a file (it uses Debug.WriteLine() at the moment) and...
5
by: c676228 | last post by:
Hi all, I am stuck with this problem. the code is like this: Dim sqlreader As SqlDataReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection) ...
7
by: Dabbler | last post by:
I'm using an ObjectDataSource with a stored procedure and am getting the following error when trying to update (ExecuteNonQuery): System.Data.SqlClient.SqlException: Procedure or Function...
6
by: rn5a | last post by:
Suppose a SQL Server 2005 stored procedure looks like this: ALTER PROCEDURE SPName @UserID int SELECT COUNT(*) FROM Table1 WHERE UserID = @UserID SELECT COUNT(*) FROM Table1 In the ASPX...
0
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...
0
BarryA
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...
0
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...
0
marktang
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,...
0
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...
0
Oralloy
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,...
0
jinu1996
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...
0
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...
0
tracyyun
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.