Solved

ASP .NET 2.0 SQL Select Command Problem

Posted on 2006-06-28
2
685 Views
Last Modified: 2012-06-21
I have the following code:

Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim DSflgasgiveaway As SqlDataSource
        Dim SelectArgs As SqlDataSourceCommandEventArgs
        DSflgasgiveaway.ConnectionString = ConfigurationManager.ConnectionStrings("flgasgiveawayConnectionString1").ToString
        DSflgasgiveaway.SelectCommandType = SqlDataSourceCommandType.Text
        DSflgasgiveaway.SelectCommand = "Select * from flgasgiveaway WHERE ItemCode = @itemcode"
        DSflgasgiveaway.SelectParameters.Add("itemcode", txtCode.Text)
       
        Dim rowsaffected As Integer = 0
       
        Try
            rowsaffected = DSflgasgiveaway.Select()
           
        Catch ex As Exception

        End Try
    End Sub

I have the following errro message when i hover my mouse over the select statement:

'Argument not specified for parameter 'arguments' of Public Function Select(arguments As System.Web.UI.DataSourceSelectArguments) As System.Collections.IEnumberable'

What am I missing?????  

Thanks in advance!
0
Comment
Question by:spmcmorrow
2 Comments
 
LVL 9

Accepted Solution

by:
bele04 earned 500 total points
Comment Utility
the Select method of the SqlDataSource requires that a DataSourceSelectArguments need to be passed to it as a parameter.

you need to create an instance of an object of type DataSouceSelectArguments and pass it to the Select Method like this:

Dim ds As New DataSourceSelectArguments

DSflgasgiveaway.Select(ds)

note that the Select method returns a DataView if the DataSourceMode property of your SqlDatasource is set to Dataset, if it is set to DataReader then it returns a IDataReader.  The Select Method of your SqlDataSource doesn't return an Integer so this line of your code:

rowsaffected = DSflgasgiveaway.Select()

is wrong.

hope that clears somethings out.
-bele04-
0
 

Author Comment

by:spmcmorrow
Comment Utility
Thanks a bunch!
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now