Solved

ASP .NET 2.0 SQL Select Command Problem

Posted on 2006-06-28
2
688 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
ID: 17006353
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
ID: 17006539
Thanks a bunch!
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

821 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