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

invoke stored sql procedure, from vb2005, with parameters

2
the following code, in a vutton click, successfully calls a stored procedure in sql server..


Dim strconn As String
strconn = "Provider=SQLOLEDB;DATA SOURCE=" + sDataSource + ";initial catalog = madisonavenuefurniture;Trusted_Connection=yes;"
Dim cn As New OleDb.OleDbConnection(strconn)
cn.Open()
Dim cmd As New OleDb.OleDbCommand("pPONumberWrite", cn)
cmd.ExecuteNonQuery()
however

when I amend it to try and pass parameters to the stored procedure, the parameters are not seen...

Dim strconn As String
strconn = "Provider=SQLOLEDB;DATA SOURCE=" + sDataSource + ";initial catalog = madisonavenuefurniture;Trusted_Connection=yes;"
Dim cn As New OleDb.OleDbConnection(strconn)
cn.Open()
Dim cmd As New OleDb.OleDbCommand("pPONumberWrite", cn)
cmd.Parameters.AddWithValue("@P1", "2")
'cmd.Parameters.AddWithValue("@P2", "1649")
cmd.ExecuteNonQuery()

whynot?

help
Oct 21 '06 #1
3 1513
scripto
143 100+
have you amended the stored procedure to accept the parameters???
Oct 21 '06 #2
vernon
2
have you amended the stored procedure to accept the parameters???
yes... believe I have. Executed from object explorer in server managment studio, it asks for parameter value, and works well!
Oct 22 '06 #3
scripto
143 100+
well your code looks ok - can we see the stored proc?
Oct 23 '06 #4

Sign in to post your reply or Sign up for a free account.

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...
3
by: Michael | last post by:
This one's really got me. I have a VB.NET (version 1.1.4322) project that provides an easy way to execute stored procedures on a generic level. When I run the code on computer A (running SQL...
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...
2
by: Aragorn | last post by:
I want to load into a SqlCommand objet an existing stored procedure. I know that by using the Parameters collection I can add parameters, but how can I retrieve the parameters already defined from...
2
by: Dino L. | last post by:
How can I run stored procedure (MSSQL) ?
3
by: Bilbo | last post by:
I have a a headscratcher here: I have a form that when submitted should do 2 things when a user enters data and then clicks the Add button. Here goes: 1. Call a stored procedure called...
6
by: SandySears | last post by:
I am trying to use a stored procedure to insert a record using VS 2005, VB and SQL Server Express. The code runs without errors or exceptions, and returns the new identifer in the output...
5
by: darjonase | last post by:
Alright, so I am creating an entire database in code since I have no idea how to bundle a created database in an install of my application. I know how to create the database and the tables in...
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
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: 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
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
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
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...
0
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...

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.