473,385 Members | 1,647 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,385 software developers and data experts.

Stored Procedure

Hello,

How can I execute a stored procedure through a odbc command? My stored
procedure only modifies data in db, it doesn't returns any rows and doesn't
use any parameter.

Thank you

--
Catalin Porancea
Nov 20 '05 #1
6 7090
I did, but I got an error saying:

The command text is invalid. To call a stored procedure through ODBC managed
provider the following syntax should be used:

{ CALL <stored procedure name> ( <parameter list> ) }

--
Catalin Porancea
"Scott Meddows" <sc******************@tsged.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
: You can use ExecuteNonQuery method on your connection object.
:
: "Catalin Porancea" <cp*******@midwestern.net> wrote in message
: news:%2****************@tk2msftngp13.phx.gbl...
: > Hello,
: >
: > How can I execute a stored procedure through a odbc command? My stored
: > procedure only modifies data in db, it doesn't returns any rows and
: doesn't
: > use any parameter.
: >
: > Thank you
: >
: >
: >
: > --
: > Catalin Porancea
: >
: >
:
:
Nov 20 '05 #2
"Catalin Porancea" <cp*******@midwestern.net> schrieb
How can I execute a stored procedure through a odbc command? My
stored procedure only modifies data in db, it doesn't returns any
rows and doesn't use any parameter.


This is a VB.NET language group. Please turn to
microsoft.public.dotnet.framework.adonet.
--
Armin

Nov 20 '05 #3
"Catalin Porancea" <cp*******@midwestern.net> schrieb:
How can I execute a stored procedure through a odbc
command? My stored procedure only modifies data in
db, it doesn't returns any rows and doesn't use any
parameter.


Why don't update to ADO.NET?

This is a VB.NET language group. Please turn to the ADO.NET newsgroup:

news://msnews.microsoft.com/microsof...amework.adonet

Web interface:

http://msdn.microsoft.com/newsgroups...amework.adonet

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #4
"Herfried K. Wagner [MVP]" <hi*******@m.activevb.de> schrieb:
Why don't update to ADO.NET?


Just ignore the line above...

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #5
ok, if I want to execute the command as a select statement I only have to
use

cmd.commandtext = "select * from table"
cmd.executenonquery

I tried to use
cmd.commandtext = "exec sp_procedure"
cmd.executenonquery

but I get an error.

Does anybody have a solution instead of sending me from one group to
another. Arm, my question is exactly about VB .Net.

--
Catalin Porancea
"Catalin Porancea" <cp*******@midwestern.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
: Hello,
:
: How can I execute a stored procedure through a odbc command? My stored
: procedure only modifies data in db, it doesn't returns any rows and
doesn't
: use any parameter.
:
: Thank you
:
:
:
: --
: Catalin Porancea
:
:
Nov 20 '05 #6
"Catalin Porancea" <cp*******@midwestern.net> wrote in news:
#F**************@tk2msftngp13.phx.gbl:

Does anybody have a solution instead of sending me from one group to
another. Arm, my question is exactly about VB .Net.

I agree with Armin that your question would probably recieve a quicker
response in the ADO.Net newsgroup, but here is an answer.

Be sure to set the command type to StoredProcedure. Here is an example:
'Code starts here
Dim strCN As String = ConfigurationSettings.AppSettings("Northwind_DSN")
Dim cn As New SqlConnection(strCN)
Dim cmd As New SqlCommand

cn.Open()

With cmd
.Connection = cn
.CommandType = CommandType.StoredProcedure
.CommandText = "usp_region_save"
.Parameters.Add("@id", mintRegionId)
.Parameters.Add("@region", mstrRegionDescription)
.ExecuteNonQuery()
End With

cmd = Nothing
cn.Close()

Nov 20 '05 #7

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...
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"...
4
by: Rhino | last post by:
Is it possible for a Java Stored Procedure in DB2 V7.2 (Windows) to pass a Throwable back to the calling program as an OUT parameter? If yes, what datatype should I use when registering the...
8
by: Thomasb | last post by:
With a background in MS SQL Server programming I'm used to temporary tables. Have just started to work with DB2 ver 7 on z/OS and stumbled into the concept of GLOBAL TEMPORARY TABLE. I have...
2
by: Dino L. | last post by:
How can I run stored procedure (MSSQL) ?
0
by: Amber | last post by:
Stored procedures are faster and more efficient than in-line SQL statements. In this article we will look at two SQL Server stored procedures; one using an input parameter and one not, and see how...
3
by: kd | last post by:
Hi All, How to debug a stored procedure? Thanks, kd
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...
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
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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...
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
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 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.