sqldatasource

Delete Record from GridView AND File from server in one click

I'm trying to delete a record from Gridview1 at the same time delete the corresponding image file off the server in a single click. (Each row in Gridview1 has an associated image file on the server.) To delete the record, I'm using asp:CommandField showDeleteButton="true" along with a sqlDataSource's DELETE statement. During that pr...

How can I see the actual SQL an ASP SqlDataSource will run (after binding)

This is a very simple question, but one I can't find an answer to. If I have an SqlDataSource that takes parameters, how can I see the actual SQL that will be executed against the DB after the binding takes place? (I have tried adding a breakpoint to code on the onBinding event of the SqlDataSource) Thanks for any help Ryan ...

SQL Data Source - store procedure and return parameter

I have a store procedure in SQL Server which returns a value: CREATE PROCEDURE [dbo].[insertProc] @value1 INT, @value2 INT AS BEGIN SET NOCOUNT ON; INSERT INTO table1(value1,value2) VALUES (@value1,@value2) RETURN SCOPE_IDENTITY(); END I connect to the DB from ASP.NET using SQL Data Source, which is configured li...

Delete file when deleting row from table

On my website I use simple file management. User can upload files, see the list and delete them. In database I have one table Files which contain information about files (file name, description, insert date). I display all the files in GridView control with SQLDataSource. DeleteCommand="DELETE FROM Files WHERE id = @id" What I want ...

ASP.NET - VB.NET - Persist a GridView's dynamically chosen DataSourceID over multiple button clicks

I have an app where I need to dynamically choose an SQLDataSource for a GridView so I can use 1 of 2 stored procedures, depending on who is logged into the system. My problem is that I am using logic like this, in the button click... If Session("SiteType") = "Type1" Then GridView1.DataSourceID = "SqlDataSource2" Else GridV...

How do I passing sqldatasource parameters using javascript

I have sqldatasource which is type store procedure and I want to passing parameters into it but using javascript " SelectCommandType="StoredProcedure" SelectCommand="sp_GetEmployeeByRoleId"> ...

using different number of parameters for sqldatasource insert and update

I have a sqldatasource with insert and update commands. I list 10 user fields in the detailsview that uses the sqldatasource. However, when i insert, I insert all 10 fields, but when I update, I only want to update 8 fields. This is causing a problem because I believe all 10 fields displayed are being passed as parameters even though ...

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 parameter which has default value. when I refresh the schema or click "test query", I see ...

Where is SqlDataSource getting default list of connection strings?

Aspnet 3.5. I am using the Configure Data Source wizard to configure a SqlDataSource in a new project in a new solution and under "Which data connection should your app use to connect to the db?" I am being given a ddl of two connection strings to choose from (in addition to the ability to create a new connection.) The question is, w...

SqlDataSource manual Update how to?

Hi, I'm looking for a solution how to manualy call Update method on a SqlDataSource connected to a DetailsView. The problem is that if I call the Update method from a button.onclick event nothing happens. So I checked the parameters value in the Updating event of the sqldatasource and they are all null. I don't wan't to use a Command but...

Problem creating SqlDataSource for GridView

Trying to create a SqlDataSource in Visual Studio 2005. When I specify my source database, which is a SQLServer 2008 database, I get a valid connection but receive the error message that the datasource must be SqlServer 2005 beta or above when I click continue, i.e. go to the configure page of the wizard. wtf ...

ASP VB .NET SqlDataSource Update Error Fails

In VS 2005, using VB, page has a FormView linked to an SqlDataSource. When data is changed and Update button pressed, changed data is cleared in FormView but database table is not updated. Below is the SqlDataSource code. Any ideas why the Update doesn't work? <asp:SqlDataSource ID="SqlDataDetails" runat="server" ConflictDetection="Comp...

How to get the datasource of a gridview

Hi, I am using a gridview with sqldatasource. How to get back the datasource in the codebehind as a datatable? ...

ASP.NET: How do "update" a field in the <EditItemTemplate> that has a null value in the database (SQL)

Hi All, I am using a FormView control. The allows me to update records in the database. However, when a database field is null I can not update the field on the form. It works fine when the field is not a null value. I am not using any code behind (C#) to bind the data or manipulate the data. I have read that when there is a nu...

ASP.NET - SQLDataSource - FilterExpression - Problem with Empty Strings

In this test application, I am filtering by two ControlParameters. As you can see in the first codeblock, both parameters have a default value of %. This code works great. However, in the second code block, please note that the Default Values are eliminated. The second code block works as long as neither Textbox's text is blank. For some...

SQL datasource from stored proc

Ok, here is the thing, I have a stored proc which returns three sets of data results, i can use the results in code behind to databind a repeater or whatever, something like so... Using cmd As New SqlCommand("TICKET_TECH_S", oConn) cmd.CommandType = CommandType.StoredProcedure Using da As New SqlDataAdap...

SQLDataSource binds Data twice :(

Hello, this problem is driving me really mad. In an Asp.Net-application, I have two DropDownLists, DropDownStore and DropDownCampaign. <asp:DropDownList ID="storeDropDown" AppendDataBoundItems="true" AutoPostBack="true" DataSourceID="storeSqlDataSource" DataTextField="Name" DataValueField="StoreId" runat="server" OnSe...

asp.net use details view if 1 record is returned and gridview if more than one record

I'm using a details view and a sqldatasource control to populate it. Every once in a while i get an error message because more than one row is returned. How can I have the data display in a gridview instead if more than one row is returned? ...

how do I check that a SqlDataSource returned data?

Hi-- I have a asp.net page that has several SqlDataSources defined that feed data into some graphs. The problem is that the graph product does not handle "no data" very well, and throws an error. I'd like this to handle the situation more gracefully-- so I need to check whether the SqlDataSource returned data or now before rendering the ...

Listview and SQLDataSource render nothing

I've never used either of these 2 controls before and I'm stuck with no visible rendering of the page (compiles and runs but produces nothing); I have no code behind file with this simple asp.net page and I am using Visual Studio 2008: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="zList.Index" %...