DataSource Controls :: Delete DB Record Through Service
May 31, 2010
i am trying to create an asp.net service where it can delete specific records from the databas, this is by code so far:
[Code]....
this is the error i am getting
[Code]....
the code that it refers to by line 134 is myDataAdapter.Fill(delds, "comments"); so i guest is somthing to do with the .fill
View 15 Replies
Similar Messages:
Mar 5, 2010
I have 3 pages, one to add a category, one to edit the category, and one to delete the category. The add and edit work fine. The delete is not working for some reason. I click the link on my site to delete it, and I'm just staring at the green bar in my browser taking a long time. The add and edit don't take long at all to perform their function. I'm thinking this is a connection string issue, but I don't see how it can be the case. It relies on web.config for it just like the other pages. Following is the delete page code behind and also delete cascade from the business logic area. After the page refreshes, I'm not getting any diagnostics or error messages which I have in the code. Doesn't this have to mean a db connection issue?
[Code]....
View 10 Replies
Jun 4, 2010
I have a table that have LibraryID and LibraryParentID.
LibraryID int Unchecked
Name varchar(50) Checked
Description varchar(200) Checked
LibraryLevel int Checked
LibraryParentID int Checked
LibraryTypeID int Unchecked
I want to write a sql to delete the currrent select parent and well as all child record, how can I do that?
View 4 Replies
Jan 24, 2011
I am working with asp.net 2008 and sql server 2005 . I get a situation where i have to delete data after 30 days. a suitable query how to do the same. I have go through different query but nothing going right for me.
View 2 Replies
Apr 11, 2010
I have a sqlDatasource with a SelectParameter ControlParameter linked to a dropdownlistIs there an a way to select all records like *
[Code]....
So I can select records by year, but is there a value that will select all records for the @Year Parameter so I can display all records?
View 3 Replies
May 11, 2010
when i want insert a record i see an error like this Can't perform Create, Update, or Delete operations on 'Table(MainMenuLink)' because it has no primary key. with this codes:
MyLinqDataClassesDataContext db = new MyLinqDataClassesDataContext();
MainMenuLink li = new MainMenuLink { Link = "www.tprogrammer.com", LinkSubject = "subject" };
db.MainMenuLinks.InsertOnSubmit(li); [code]....
View 2 Replies
Jun 1, 2010
i am trying to create an asp.net service where it can delete specific records from the databas, this is by code so far:
View 1 Replies
Dec 3, 2010
how to Delete Child Record And Later Delete The Parent Record if it has no child
Trigger might be the answer but i don t know how!
View 1 Replies
Sep 14, 2010
I created a ListView and attempted to delete a record using the delete button and native procedures. It failed and threw an error.Pass in a valid dictionary for delete or change your mode to OverwriteChangesIn researching this issue, it appeared there is a problem with the list view when deleteing and
ConflictDetection is set to
[Code]....
[Code]....
[Code]....
[Code]....
[Code]....
[Code]....
[Code]....
[Code]....
[Code]....
View 1 Replies
Jan 27, 2011
I have a gridview with edit and delete parameters enabled. When I click on the edit link, I can edit the record successfully. However when I click on the delete link, nothing happens (the record does not get deleted).
View 5 Replies
Jun 24, 2010
I am counting from a table for that i have written code as below
protected void get_Id_Afterpoint()
{
int counter = 0;
string strSql = "select count(*) as ID from tblEnergy where ID=?";
OdbcCommand com = new OdbcCommand(strSql, con);
com.Parameters.AddWithValue("ID", DropDownList1.SelectedValue);
OdbcDataAdapter oda = new OdbcDataAdapter(com);
DataTable dt = new DataTable();
oda.Fill(dt);
if (dt.Rows.Count == 0)
{
lblID2.Text = "1";
}
else
{
counter = dt.Rows.Count;
counter = counter + 1;
lblID2.Text = Convert.ToString(counter);
}
}
there is no record related to DropDownList1.SelectedValue. but as i am counting if(dt.rows.count) and i put break point on the bolded part it shows 1 record. how it can be possible?
View 5 Replies
Dec 20, 2010
I am creating an album using the following stored procedure, which returns the primary key for the newly created record:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[fpa_sp_albums_update_insert]
@album_id int,
@album_name nvarchar (50),
@album_descr nvarchar(250),
@album_img_cover_id_FK int,
@album_creation_date date
AS
If @album_id > 0
UPDATE [fpa_albums]
SET
album_name=@album_name,
album_descr= @album_descr,
album_img_cover_id_FK = @album_img_cover_id_FK,
album_creation_date = @album_creation_date
Where ((album_id = @album_id))
Else
INSERT INTO [fpa_albums] (
album_name,
album_descr,
album_img_cover_id_FK,
album_creation_date)
VALUES (
@album_name,
@album_descr,
@album_img_cover_id_FK,
@album_creation_date)
Return SCOPE_IDENTITY();
I execute the above stored procedure using the SQLHELPER. The VB.NET code for the page is as follows:
[Code]....
However, the createdAlbumID always shows -1 instead of the id for the newly created album.
View 1 Replies
May 10, 2010
I am having a small issue i.e i am going to delete a record by using button. I have written confirm control for that. Now what i need is if i does not select any row from Grid view and click on delete i would like to raise like select atleast one record to delete can any one tell how to do..
View 14 Replies
Jul 6, 2010
I have a asp.net page where I am having a treeview and a Gridview. Based on the checked node I am adding row in Gridview, If user Click add button.
And I have a Remove button the page. If i click remove button then i need to delete the selected record from Gridview.
Below is my code for add.
[Code]....
How can i delete the selected row and bind the grid again.
View 1 Replies
Jul 29, 2010
I am New to grid below s my code to display recors into grid
i need to edit delete and insert the recod in grid
ITEM_CODE_GCRS is my unique record value
-----ASPX Page
[Code]....
------ Code Behinde
[Code]....
View 3 Replies
Jun 3, 2010
First of all, when using the GridView control with Delete enabled, when I delete a record is the event handler in the code behind file handled before the record is deleted or after? I need to obtain a counter value that I have set up in the record before it is deleted so that I can decrement all of the counter values that followed it. Is the best way to do this to open a connection in the Delete even handler and take care of it by code, or is there another way to access a column value from the GridView control that would simplify the process?
View 2 Replies
Feb 3, 2011
Type: 28978 into this site: [URL]
Students have to chose a subject in a row. This will be updated in the table above.
I use this Stored procedure:
[Code]....
I would like my button to Insert/Delete records in the table. How can a button in a GridView row choose parametres form the right row?
My code...
[Code]....
View 9 Replies
Feb 27, 2011
I have a question about linq delete.
I have 2 table in database and they are joined.
First Table: UserID, UserName, UserSurname, UserPhone, CompanyId
Second Table: CompanyId, CompanyName
First Table I have many recods with related second table.
I want to delete one company in second record, But firtly I have to delete users (more than 1)
How can I delete it with using linq?
View 2 Replies
Mar 15, 2010
I have a gridview with delete buttons for each record (I've used AccessDataSource). I have loaded the data in and have many duplicate records.
I just want to use the delete button delete each duplicate record while remains many duplicate records. For example:
I used the following query to load in duplicate records:
SELECT * FROM TableA WHERE ([ControlA] IN (SELECT [ControlA] FROM TableA GROUP BY [ControlA] HAVING (COUNT [ControlA]) > 1)))
ID ControlA PIN# FaceValue Date
delete 76637 128232 1234 5 6/4/2006
delete 72722 128232 1234 5 6/4/2006
delete 76638 234567 2345 10 7/3/2006
delete 72723 234567 2345 10 7/3/2006
What is the query to delete single duplicate record instead of deleting all duplicate records?
View 25 Replies
May 7, 2015
insert update delete in gridview using sqldatasource in asp.net
View 1 Replies
Aug 3, 2010
Is it possible to use LINQ to delete a row in a table within an SQL database? I am using an ADO connected command statement to delete a row where a string column equals a name. But, I would prefer to use an easier way with LINQ, if possible.
View 3 Replies
Nov 26, 2010
I have a list of documents and different actions performed for each records. To delete the record i need the id to pass to the controller. I use JQuery to perform deletion. In it I need to Id of the record. The Following is my view:
[Code]....
$.post("/BuildDocument/DeleteBuildDocument", {need to pass id here..}); need the id(BldDocId). How can i get it?
View 3 Replies
Mar 22, 2011
I'm trying to delete a record in DataGridView but it is giving me this error:
Must declare the scalar variable "@reg_id".
My reg_id is the primary key column in the table. How can I resolve this?
View 1 Replies
Dec 11, 2010
I have asp.net app where I am using gridview for data showing, editing and deleting. Now I want to delete or edit record from table and I need to pass 3 cols in DataBinder.Eval(Container.DataItem,"colName"). how i can do this?
EDITED
Basically when i need to update or delete record from asp.net app, I have to pass values of 3 columns (which are composite keys) to my UDF. Now How I can pass 3 different values to DataBinder.Eval() and reading them in GridView Rowcommand event.
View 2 Replies
Jun 23, 2010
I have to delete record from the database and I am using the data list control to display the data. I have to delete the data from two table, that means I have to pass an id to a stored procedure which will delete the data from the database.
I am confused how can I do this? As I am not using the generic functionaliteis of the DataList Control and I don't want to use them. I have alos another choice to create a new page and pass the id through query string using hyperlink. But I don't want to do that?
View 2 Replies