473,792 Members | 3,042 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Common procedures for executing all stored procedure

Hi all
I got problem regarding executing all stored procedure through
common procedures where we have different parameter with different
names, type and data type
The Function is as follows

Where strProcString is procedure name and strParamString is all
parameters concatenated by @

Public Function CeateDataSetSQL (ByVal strProcString As String, ByVal
ByVal strParamString As String) As DataSet
Dim dsLIS As DataSet
Dim Varr As System.Array
Dim Varr2 As System.Array
Dim intNoOfParamete rs As Integer
Dim j As Integer
If Not IsConnectionOpe n Then
RaiseEvent ConnectionStatu s("Connecting to SQL Server")
End If
Try

Dim conDatabase As New SqlConnection(s trConnection)
Dim cmdCommand As New SqlCommand(strP rocString,
conDatabase)
cmdCommand.Comm andType = CommandType.Sto redProcedure

dsLIS = New DataSet
sdaLISAdapter = New SqlDataAdapter( cmdCommand)
Varr = Split(strParamS tring, "@")
intNoOfParamete rs = UBound(Varr)

For j = 1 To intNoOfParamete rs
cmdCommand.Para meters.Add(New SqlParameter).V alue =
CType(Varr.GetV alue(j), String)
Next j

Me.sdaLISAdapte r.Fill(dsLIS, "Result")
Catch ex As Exception

MsgBox(Err.Numb er & vbNewLine & Err.Description )

End Try

Return dsLIS

End Function

Where BOLD code give Error as parameter1 not present in given stored
procedure

Dec 24 '05 #1
1 1471
Hi,

When you add a parameter to a sqlcommand you need to provide the
parameter name and value.

cmdHit.Paramete rs.Add("@Id", strId) ' use addwithvalue for vs 2005

Ken
-------------------------
"A1 Ronen" <ro*******@yaho o.com> wrote in message
news:11******** **************@ g49g2000cwa.goo glegroups.com.. .
Hi all
I got problem regarding executing all stored procedure through
common procedures where we have different parameter with different
names, type and data type
The Function is as follows

Where strProcString is procedure name and strParamString is all
parameters concatenated by @

Public Function CeateDataSetSQL (ByVal strProcString As String, ByVal
ByVal strParamString As String) As DataSet
Dim dsLIS As DataSet
Dim Varr As System.Array
Dim Varr2 As System.Array
Dim intNoOfParamete rs As Integer
Dim j As Integer
If Not IsConnectionOpe n Then
RaiseEvent ConnectionStatu s("Connecting to SQL Server")
End If
Try

Dim conDatabase As New SqlConnection(s trConnection)
Dim cmdCommand As New SqlCommand(strP rocString,
conDatabase)
cmdCommand.Comm andType = CommandType.Sto redProcedure

dsLIS = New DataSet
sdaLISAdapter = New SqlDataAdapter( cmdCommand)
Varr = Split(strParamS tring, "@")
intNoOfParamete rs = UBound(Varr)

For j = 1 To intNoOfParamete rs
cmdCommand.Para meters.Add(New SqlParameter).V alue =
CType(Varr.GetV alue(j), String)
Next j

Me.sdaLISAdapte r.Fill(dsLIS, "Result")
Catch ex As Exception

MsgBox(Err.Numb er & vbNewLine & Err.Description )

End Try

Return dsLIS

End Function

Where BOLD code give Error as parameter1 not present in given stored
procedure

Dec 24 '05 #2

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

Similar topics

0
2261
by: rvdw | last post by:
Hi All, I've a serious problem with executing stored procedures (SQL2000) from an Access db (version 97). After executing a stored procedure , msaccess hangs. The whole call to the procedure is running fine, but immediatly after this msaccess hangs, when the focus goes back to the calling form ? Has anyone any idea what i can test or look at. Thanks a lot !!!!!!
1
1684
by: Eugene Anthony | last post by:
Method 1: set rs = Server.CreateObject("ADODB.Recordset") objConn.usp_RetrieveCategories rs Method 2: set rs = objConn.Execute("usp_RetriveCategories") Which method is considered to efficient. Is it method 1 or method 2?.
1
30746
by: Anthony Robinson | last post by:
I'm executing a stored procedure and getting the SQL0440N No authorized routine named "AMROBI2.CREATEAIMCONNECTION" of type "PROCEDURE " having compatible arguments was found. The schema exists, the stored procedure exists, the user executing the procedure has execute permissions on the procedure and also has insert, update, delete rights on the table being accessed in the stored procedure. I'm sending in the correct number of input...
0
4280
by: Rhino | last post by:
I've written several Java stored procedures now (DB2 V7.2) and I'd like to write down a few "best practices" for reference so that I will have them handy for future development. Would the experts here agree with the following? Would they add any other points? 1. If the shop standard calls for logging of application errors, a stored procedure should log any error that it encounters immediately upon detecting it and then return to the...
1
2404
by: Alex | last post by:
Hi all, Just been dabbling with java stored procedures and I'm having problems replacing System: db2 8.1.4 on RH 7.1 linux system 1). Look at java jdbc samples as supplied with db2 and run the SpServer and Spclient progs against the default database SAMPLE. And everything works.
5
3398
by: Rhino | last post by:
I am trying to determine the behaviour of stored procedures in DB2 V8.2.x in Windows/Unix/Linux and how I can control that behaviour. Some documentation in the manuals is confusing the issue somewhat. First, am I right in understanding that the normal behaviour of a stored procedure, fenced or unfenced, is to only go into memory when it is invoked and to be swapped out of memory when it is not needed any more? Second, am I right in...
1
1573
by: esmith2112 | last post by:
We all of a sudden find ourselves in dire straits, because we have one of those mysteries where everything used to work, and apparently, all of a sudden everything went to pot just in time for a major software release. All of our Java stored procedures have developed some bad behavior and we've exhausted our resources in figuring this out. Symptoms: 1. Store procedures have stopped returning result sets. Whereas before, it would...
0
2582
by: billmiami2 | last post by:
Perhaps many of you MS Access fanatics already know this, but it seems that stored procedures and views are possible in Jet. I thought I would leave this message just in case it would help anyone. I discovered this the other day while doing some experiments with ADO and ADO.NET. Basically, I wanted to run a stored MS Access query with parameters using the syntax Execute MyProcedure @Param1, @Param2...
2
8140
by: kanda | last post by:
Hello. I am developing the application (VBA&ODBC, to be exact) which periodically calls the stored procedures in the IBM DB2. A few of the procedures require executing with isolation level RR ( ANSI "SERIALIZABLE" ), not the default; default is CS (ANSI "Read Committed")). The procedure language is SQL. According to the documentation, I can adjust procedure *run*-time isolation level by setting *compile*-time dataserver-wide option
0
10211
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 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...
0
10000
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 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...
0
9033
agi2029
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...
1
7538
isladogs
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...
0
6776
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();...
0
5436
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...
0
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4111
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
2
3719
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.