Solved

ASP .NET 2.0 SQL Select Command Problem

Posted on 2006-06-28
2
686 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Hovering effect 9 46
ASP.Net Session State alternatives 3 57
asp.net mvc input file 2 32
Make an ajax call ithat alters url and updates a listview in asp.net 1 20
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

919 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

20 Experts available now in Live!

Get 1:1 Help Now