Wrox Programmer Forums
|
Visual Basic 2008 Essentials If you are new to Visual Basic programming with version 2008, this is the place to start your questions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2008 Essentials section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 29th, 2010, 04:38 PM
Registered User
 
Join Date: Mar 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default parameterized query

From jpf101

How can one use what the help menus call a parameterized query in a program?
What argument(s) is it looking for? I could find nothing in the help to answer this question.

If I run the few lines below with line 15 ( it begins with “imb = …) commented out, it runs correctly but shows textbox4 answers (as it should) as zero.
When I uncomment line 15, I get errors as shown below
Code:
Public Class Form1
    Dim ima, imb, rw1, cl1 As Integer

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'CardDataSet.cardb' table. You can move, or remove it, as needed.
        Me.CardbTableAdapter.Fill(Me.CardDataSet.cardb)
        'TODO: This line of code loads data into the 'CardDataSet.carda' table. You can move, or remove it, as needed.
        Me.CardaTableAdapter.Fill(Me.CardDataSet.carda)
        rw1 = 3
        cl1 = 4
        ima = CardaTableAdapter.where_rw_equal_3_and_cl_equal_4
        TextBox1.Text = " ima = " & ima
        TextBox2.Text = " ima squared = " & ima * ima
        TextBox3.Text = " rw1 = " & rw1 & "  ,  " & " cl1 = " & cl1
        imb = CardaTableAdapter.where_rw_equal_rw1_and_cl_equal_cl1
        TextBox4.Text = " imb = " & imb & " ima squared = " & imb * imb
    End Sub
End Class
Error 1 Argument not specified for parameter 'cl1' of 'Public Overridable Overloads Function where_rw_equal_rw1_and_cl_equal_cl1 (rw1 As Integer, cl1 As Integer) As Object'. C:\Users\John\AppData\Local\Temporary Projects\test5\Form1.vb 15 test5
Error 2 Argument not specified for parameter 'rw1' of 'Public Overridable Overloads Function where_rw_equal_rw1_and_cl_equal_cl1 (rw1 As Integer, cl1 As Integer) As Object'. C:\Users\John\AppData\Local\Temporary Projects\test5\Form1.vb 15 test5

The table adapter looks like this
SELECT im
FROM carda
WHERE (rw = @rw1) AND (cl = @cl1)
 
Old April 29th, 2010, 10:01 PM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi

I have done a small sample (http://dotnetdud.blogspot.com/2010/0...-in-c-net.html)

Can you check if this helps you

Cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
 
Old May 3rd, 2010, 03:22 PM
Registered User
 
Join Date: Mar 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default thank you

Thanks for trying but I was unable to use your example

In a program, I have large data table from which I need to use two of the columns in the table to retrieve another column and then use the result of that column in math calculation(s). I tried to figure out how to use LINQ but could not get data out in format to use in calculation.

I am now rewriting program with large select case verbage to do same thing.

Again, thanks for trying to help





Similar Threads
Thread Thread Starter Forum Replies Last Post
Parameterized Property surendraparashar C# 2005 4 October 17th, 2007 11:33 PM
DateTime Typed Paramater on Parameterized Query Mutia VB.NET 2002/2003 Basics 1 July 25th, 2007 08:57 AM
Calling Parameterized Update Query from C# fcortes C# 6 July 11th, 2007 08:47 AM
Parameterized Query asters VB.NET 2002/2003 Basics 5 July 9th, 2007 12:08 PM
Sql Parameterized query, @ or ? Pauline BOOK: Beginning ASP.NET 1.0 2 January 26th, 2005 11:33 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.