473,729 Members | 2,064 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 1468
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
2259
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
1682
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
30740
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
4275
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
2402
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
3395
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
1569
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
2579
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
8137
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
8766
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,...
0
9428
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, 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...
0
9291
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
8160
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...
0
6026
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
4535
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
4799
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2698
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2171
bsmnconsultancy
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...

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.