The SqlDataSource control enables you to use a Web control to access data located in a relational database, including Microsoft SQL Server and Oracle databases. The SqlDataSource control uses ADO.NET classes to interact with any database supported by ADO.NET. You can use the SqlDataSource control with other controls that display data, such as the GridView, FormView and DetailsView controls to display and manipulate data using little or no code.
Questions tagged [sqldatasource]
967 questions
6
votes
7 answers
Can I get the query that was executed from the SqlDataSource?
I have a sql query for my SelectCommand on my SqlDataSource. It looks like the following:
SELECT * FROM Books WHERE BookID = @BookID
A TextBox feeds the @BookID parameter using an Asp:ControlParameter.
When I view the SelectCommand when stepping…

Xaisoft
- 45,655
- 87
- 279
- 432
6
votes
2 answers
empty gridview although the sqldatasource has values
I have really weird situation.
I've created new aspx page, and without using ANY custom logic objects (everything created with visual studios wizards) tried to create grid view from sqldatasource.
The data comes from stored procedure, with single…

SimSimY
- 3,616
- 2
- 30
- 35
6
votes
1 answer
Access The Data Retrieved
I have been trying to find an answer to this question now for days and I find it hard to believe that this can't be done.
I want to get to the DataSet/DataTable that is built when a SqlDataSource.Select method is called automatically by the ASP.NET…

dscarr
- 1,830
- 2
- 17
- 21
5
votes
2 answers
Gridview why all visible rows are set to dirty?
I'm using the BulkEditGridView control as discussed http://roohit.com/site/showArc.php?shid=bbb62, and it's perfect for my needs. The problem I'm having is that whenever I save, every visible row (I have paging enabled) gets updated. Stepping…

MAW74656
- 3,449
- 21
- 71
- 118
5
votes
3 answers
How to specify parameter value for stored procedure in SqlDataSource
Being new to using the declarative syntax of SqlDataSource I am trying to figure out a way to set the value of a parameter to a stored procedure. I have a Client_ID that is passed via the Request Object and I need to set the Client_ID before the…

webworm
- 10,587
- 33
- 120
- 217
5
votes
1 answer
Adding ControlParameter to SqlDataSource prevents query and databinding?
I have a SqlDataSource that calls a stored procedure and it works fine. If I add a tag to add an additional argument, then the query never fires and the databinding never occurs. Suggestions?
This works:

Seth Petry-Johnson
- 11,845
- 7
- 49
- 69
5
votes
4 answers
'DropDownList1' has a SelectedValue which is invalid because it does not exist in the list of items. Parameter name: value
I'm using TemplateField in GridView to implement edit/delete from database.
I'm Querying Data with the SqlDataSource Control.
when I edit the Table from page I get following error:
'DropDownList1' has a SelectedValue which is invalid because it…

GorvGoyl
- 42,508
- 29
- 229
- 225
5
votes
2 answers
how do I check that a SqlDataSource returned data?
I have an asp.net page that has several SqlDataSources defined that feed data into some graphs. The graph product does not handle "no data" gracefully, and throws an exception. I'd like this to handle the situation -- so I need to check whether the…

julio
- 6,630
- 15
- 60
- 82
5
votes
1 answer
Sql Equivalent to UInt16
I know that the Sql equivalent of Int16 is SqlInt16.
But what is the Sql equivalent of UInt16, UInt32 and Uint64?

user366312
- 16,949
- 65
- 235
- 452
5
votes
1 answer
Error passing Session Variable to SQLDataSource
I'm trying to run Project.aspx. Admin.apsx, when the 'VIEW PROFILE' button is clicked, is supposed to create a session "project_id" so the two SQLDataSources get the project_id values from the Session("project_id").
I'm getting this…

Brian
- 1,951
- 16
- 56
- 101
5
votes
4 answers
How to sort columns in an ASP.NET GridView if using a custom DataSource?
I can't get my GridView to enable a user to sort a column of data when I'm using a custom SqlDataSource.
I have a GridView in which the code in the ASP reference to it in the HTML is minimal:

Ben L
- 6,618
- 8
- 39
- 34
5
votes
1 answer
ORA-01036: illegal variable name/number C# (SqlDataSource) Oracle 11g
I am facing problem in updating the form view values using sqldatasource bind with Oracle database.
My Select and Insert events are working properly, all columns and parameters are correct.
But when i hit on update button below error…

himanshu
- 442
- 2
- 7
- 17
5
votes
2 answers
Must declare the scalar variable "@LoggedInUser". Error when trying to add parameter to SqlDataSource
I am using SqlDataSource to show records based on the logged in user ,

Priyank Patel
- 6,898
- 11
- 58
- 88
4
votes
4 answers
Dynamic WHERE clauses in a SqlDataSource
I'm using a SqlDataSource in a very simple application. I'm allowing the user to set several search parameters for the SDS's select command via TextBoxes, one TextBox per parameter (think txtFirstName, txtLastName, etc). I'm planning on using a…

Windy
- 79
- 1
- 1
- 9
4
votes
1 answer
ASP.Net: drop down list and data source created dynamically
I have about 10 drop down list controls that get populated. Instead of copying/pasting and modifying a few fields on each, I would like to create them programmatically. Can this be done?
Here is what one of them looks like. I would like to…

dotnet-practitioner
- 13,968
- 36
- 127
- 200