Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 11th, 2005, 08:35 AM
Authorized User
 
Join Date: Oct 2004
Location: Bristol, Nth. Somerset, United Kingdom.
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default Passing parameters to a sql stored procedure

I'm trying to call a stored procedure in the Northwind database with a single input parameter but I'm having trouble with the correct syntax. The code I've got is below. I've commented out a couple attempts which caused errors. The errors I think were reported as syntax errors at run time. So I think the code was passed to SQL which looked at it, had a laugh and returned an error. Any ideas?

 Dim conn As New SqlConnection
        conn.ConnectionString = "Trusted_Connection=yes;Addr=P2000;Initial Catalog=Northwind"
        conn.Open()

        Dim comm As New SqlCommand
        comm.Connection = conn
        comm.CommandType = CommandType.StoredProcedure
        comm.CommandText = "CustOrdersDetail @Cust"
        'comm.Parameters.Add("@Cust", SqlDbType.Int, 10248)
        'comm.Parameters("Cust").Value = 10248

        Dim dreader As SqlDataReader
        dreader = comm.ExecuteReader()

        While dreader.Read()
            TextBox1.Text = TextBox1.Text + dreader("ProductName").ToString + vbCrLf
        End While
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
One textbox, Two Parameters, with Stored Procedure GailCG Classic ASP Professional 0 March 3rd, 2006 03:39 PM
passing parameters to stored procedure in crystal prankur ASP.NET 1.0 and 1.1 Basics 0 January 10th, 2006 03:29 AM
Passing Variable MS Proj to SQL Stored Procedure Abaxt Access VBA 2 July 7th, 2005 11:05 AM
stored procedure with parameters Danmalam VB Databases Basics 0 February 27th, 2005 03:52 PM
Passing Parameters >32k to Oracle stored procedure gp_mk ADO.NET 2 December 22nd, 2003 12:49 PM



All times are GMT -4. The time now is 12:10 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.