Questions tagged [sqldatasource]

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.

967 questions
3
votes
1 answer

The GridView 'GridView1' fired event Sorting which wasn't handled

I have created a gridview using toolbox in c#, it is able to show & sort the items in my sqldatasource, but when I change the sqldatasource as it can be seen in the below code, it displays the error "The GridView 'GridView1' fired event Sorting…
HOY
  • 1,067
  • 10
  • 42
  • 85
3
votes
1 answer

Setting DateTime as a SqlDataSource parameter for Gridview

Hey I would like to display certain data with my stored procedure for the last 30 days. here is what I have done (aspx.cs file): protected void Page_Load(object sender, EventArgs e) { DateTime toDate, fromDate; …
user1051364
  • 35
  • 1
  • 6
3
votes
1 answer

Converting a DBNull to boolean when binding to checkbox in a detailsview control

This is kind of silly but I have a DetailsView that binds to a record in my database using a sqlDataSource. My problem is that the field I'm binding to is a bit field, (i,e 1 or 0) that at present allows nulls. I realize this needs to change but I…
gsirianni
  • 1,334
  • 2
  • 18
  • 35
3
votes
1 answer

Sort gridView by proper column which is TemplateField

I have got problem with sorting column in gridView. I want to select only those rows in column which name equal for example "Finished" My gridView consists of few BoundField and TamplateFields. When I want to sort by proper BoundField I put proper…
Jaro
  • 43
  • 1
  • 2
  • 6
3
votes
1 answer

The name 'SqlDataSourceEnumerator' does not exist in the current context

In a C# .net 5 program in Visual Studio I am testing a code that is using SqlDataSourceEnumerator public static List LocateSqlInstances() { List results = new List(); using (DataTable…
Ted Kon
  • 87
  • 1
  • 6
3
votes
1 answer

UpdateParameter Not Working

I am trying to set an update parameter manually. The command executes successfully and I can pull the data back to confirm that the parameter was set correctly. However my SQL update statement will not execute. If I manually define a default value…
Will
  • 989
  • 4
  • 19
  • 33
3
votes
1 answer

How to use Insert method of a datasource when data is not coming form a databaound control?

Let's say, I have a 2 TextBox, a button, and a DataSource. This is what I want. When I click the buton, the DataSource collects data from both textbox and inserts them to the database. Below is the code: What should I do the insert a a…
Richard77
  • 20,343
  • 46
  • 150
  • 252
3
votes
1 answer

ASP.NET Insert Problem

I am trying to start learning ASP.NET after a few years of PHP experience and I am having trouble getting the basics down. I am just trying to insert a row into a MS SQL Server Compact 4.0 database with ASP.NET & C#. However, my page only inserts a…
David Mihal
  • 944
  • 6
  • 23
3
votes
1 answer

GCP ProxySQL and BasicDataSource connection pool

I have an issue with a java BasicDataSource connection pool. My ProxySql is correctly configured on all my DataProc Compute engine, if I try to connect to my CloudSql instance with sqlclient it works correctly. When I try to connect to my CloudSql…
3
votes
2 answers

Creating a Custom Button in a ListView in ASP.NET

I have a Results.aspx page that displays the resulting records queried using a SqlDataSource object via a ListView. I want to add a "View" button that will appear next to each record, and when clicked will take me to a separate page that will…
LunchMarble
  • 5,079
  • 9
  • 64
  • 94
3
votes
2 answers

String data getting truncated when fetching through sql datareader

I am using a datareader to fetch a table's record values through a stored proc. but while using datareader.getstring(2) to fetch the value of the particular column, the string returned is truncated ( rest of getstrings are returning complete…
Ganesha87
  • 41
  • 3
3
votes
2 answers

Visual Studio 2015 : SQL Data Source : Unable to retrieve schema. Ensure that the ConnectionString and SelectCommand properties are valid

I have the following development environment for ASP.Net WebPage VS 2015 Professional Version, using .Net Framework 4.0 MySQL Server 5.6, MySQL .Net Connector 6.9.5 MySQL for Visual Studio 2.0.2 I am able to connect to the MySQL database server from…
3
votes
1 answer

Different SQL Datasource on Dropdownlist Selected Index Change

I have a Grid view and I want to use Two different Sql DataSources on Selecting different values from DropDownList i.e. On Selected Index Change. Please help me How should I implement that??? I don't want to use Code behind to change the Data in…
3
votes
1 answer

Dynamically built SelectCommand for GridView SqlDataSource in asp.net

I'm working with a GridView that uses a SqlDataSource element that looks like this:
sgibbons
  • 3,620
  • 11
  • 36
  • 31
3
votes
8 answers

Filling gridview from codebehind

I have a gridview control in my ASP.NET web form. I the past I have used the same code to fill a gridview with data in a Windows Forms App. Here is my code: var sql = new SQL_Statements(); var stringSql = "select col1, col2, col3, col4 from table1…
nate
  • 1,418
  • 5
  • 34
  • 73