473,394 Members | 1,742 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 call

Hello,

With ASP, I could indicate that a variable was a stored procedure with
parameters by using "adcmdStoredProc", and set the data variable with one
line using the Execute command (cnnSearch is the connection):

Set spSearch = cnnSearch.Execute("sp_web_Search " &
"'FindRegionSubRegion','','',''", adcmdStoredProc)

ASP .Net
Following the help text in quickstart, I am now using two lines:
spSearch = New SqlDataAdapter("sp_web_Search " &
"'FindRegionSubRegion','','',''", cnnSearch)
spSearch.SelectCommand.CommandType = CommandType.StoredProcedure

The question I have is, with ASP .Net, is it possible to set the CommandType
in the first line somewhat like I could do with ASP?

--
Thanks in advance,

Steven
Nov 18 '05 #1
2 1587
Unfortunately, there is no constructor for the SqlDataAdapter class that
takes a CommandType argument, and the default is Text. For the time being,
you are stuck with two lines of code.

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Client
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"Steven K" <sk****@troop.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hello,

With ASP, I could indicate that a variable was a stored procedure with
parameters by using "adcmdStoredProc", and set the data variable with one
line using the Execute command (cnnSearch is the connection):

Set spSearch = cnnSearch.Execute("sp_web_Search " &
"'FindRegionSubRegion','','',''", adcmdStoredProc)

ASP .Net
Following the help text in quickstart, I am now using two lines:
spSearch = New SqlDataAdapter("sp_web_Search " &
"'FindRegionSubRegion','','',''", cnnSearch)
spSearch.SelectCommand.CommandType = CommandType.StoredProcedure

The question I have is, with ASP .Net, is it possible to set the
CommandType
in the first line somewhat like I could do with ASP?

--
Thanks in advance,

Steven

Nov 18 '05 #2
I agree - can't see how to do this directly in 1 line using classes in
System.Data.
Take a look at the Data Access Application Block - with that you can do
something like:

DataSet ds =
SqlHelper.ExecuteDataset(conn,CommandType.StoredPr ocedure,"sp_web_Search","F
indRegionSubRegion","a","b","c");
(using a variable argument list for the stored procedure parameters)

http://msdn.microsoft.com/library/de...ml/daab-rm.asp

Richard.

"Steven K" <sk****@troop.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hello,

With ASP, I could indicate that a variable was a stored procedure with
parameters by using "adcmdStoredProc", and set the data variable with one
line using the Execute command (cnnSearch is the connection):

Set spSearch = cnnSearch.Execute("sp_web_Search " &
"'FindRegionSubRegion','','',''", adcmdStoredProc)

ASP .Net
Following the help text in quickstart, I am now using two lines:
spSearch = New SqlDataAdapter("sp_web_Search " &
"'FindRegionSubRegion','','',''", cnnSearch)
spSearch.SelectCommand.CommandType = CommandType.StoredProcedure

The question I have is, with ASP .Net, is it possible to set the CommandType in the first line somewhat like I could do with ASP?

--
Thanks in advance,

Steven

Nov 18 '05 #3

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

Similar topics

3
by: dinesh prasad | last post by:
I'm trying to use a servlet to process a form, then send that data to an SQL server stored procedure. I'm using the WebLogic 8 App. server. I am able to retrieve database information, so I know my...
0
by: Nashat Wanly | last post by:
HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET View products that this article applies to. This article was previously published under Q310070 For a Microsoft...
7
by: Jeff Wang | last post by:
Hi all, Can someone help me out? I've been struggling with this for almost a week and still have no clue what's wrong. Basically I want to write a DB2 stored procedure for OS/390 in REXX. In...
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: Dino L. | last post by:
How can I run stored procedure (MSSQL) ?
2
by: singlal | last post by:
Hi, my question was not getting any attention because it moved to 2nd page; so posting it again. Sorry for any inconvenience but I need to get it resolved fast. Need your help! ...
2
by: jed | last post by:
I have created this example in sqlexpress ALTER PROCEDURE . @annualtax FLOAT AS BEGIN SELECT begin1,end1,deductedamount,pecentageextra FROM tax
7
by: eholz1 | last post by:
Hello PHP group, Could someone help me out? I have PHP 5.2, Apache 2.0, and MySQL 5.0 running on Linux (Redhat Fedora Core 6). All that works fine. I would like to be able to "call" a stored...
0
by: SOI_0152 | last post by:
Hi all! Happy New Year 2008. Il hope it will bring you love and happyness I'm new on this forum. I wrote a stored procedure on mainframe using DB2 7.1.1 and IBM language c. Everything works...
7
by: jamesclose | last post by:
My problem is this (apologies if this is a little long ... hang in there): I can define a function in VB.NET with optional parameters that wraps a SQL procedure: Sub Test(Optional ByVal Arg1...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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.