Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

ASP .NET 2.0 SQL Select Command Problem

Posted on 2006-06-28
2
Medium Priority
?
693 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 9

Accepted Solution

by:
bele04 earned 2000 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
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 …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

650 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