DataSource Controls :: Create .net Service - Delete Specific Records From The Database?
Jun 1, 2010i 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 Repliesi 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 RepliesMy application for "Members subscriptions registration" working online and different users using it.
Database type is Mssql Server 2008 R2, Size is around 1 Gb
What happen exactly there is specific record delete from table "Members" in random times, For example I add 100 new subscriptions with around 800 records and make confirm and checking next day find it loss 3 records find it deleted.
I checked all the applications no any delete query, I removed all delete query from application to make sure no any delete also I save any delete query happen in system inside table for log.
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 RepliesHow to start at a specific record and returning only the next 5 records with T-SQL command
[Code]....
That is my concatenated SQL statement but it obviously does not work because it only looks at the top 5 records in the entire table instead of what I intended which would be to look at the top 5 records starting with the record where PostNumber equals the value of lastPost. I have been searching for a T-SQL statement that will allow me to do this but I can't find one.
i am new to this linq concept,
i have used the following code to delete multiple records in my table,
but when i hit the button insteading deleting multiple records only one record is getting deleted
below is the code
protected void Button1_Click(object sender, EventArgs e)
I have bounded my GridView to an ObjectDataSource. I have set a delete method for this ObjectDataSource. Now how can I delete my GridView's records with enable Deleting?
View 4 RepliesI want to delete recodrs from based on some join condition between two tables.
One table belongs to my DB ( table name : FeeDetails)
and second table ( TargetTable) is on different server.
I have delete records from TargetTable table based on join condition between two tables.
I am able to select records
[Code]....
how to delete child records in the first step
check if there is no more child using count row number if = 0 delete the key in parent table
parent table must have always child records in my case by Using sql data source Delete tab
I have two tables dept and employees those table have parent and child relation ship link column is deptno i want to delte department even this departmetn contains employees i want to write storedprocedure for first delte employees and after department if i wrtie these two querys in storedprocedure will i get any problems
Begin
Delete from tbl_employees where Department_Id=@Department_Id
Delete from tbl_Department where Department_Id=@Department_Id
RETURN
END
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
I'm using SQL sever 2005 and 2008 expressHow Can I create a DB backup in a specific folder??I use Management Studio but I'd like to automatically create backup without use tools
View 5 RepliesI am select one mdb database from open dialog box.All records in the database (all table data value)will automatically delete. How to implement this concept.
View 2 RepliesI am trying to delete multiple records from an access databse with ASP.NET VB but I'm doing something very wrong .....
Here is my code ...
[Code]....
I would also like to know once I get this working how I would delete, additional tables linked to this table by another field not ID ??
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 ="../error/error.aspx", LinkSubject = "subject" };
db.MainMenuLinks.InsertOnSubmit(li);
db.SubmitChanges();
ShowLinks();
what is the problem?
my table have a primary key but i dont know why give an error!!!
New to all this and trying to work out the best of doing what I need to do.
I have a little ddl with a list of 100 or so different items in it. The person clicks the button and it gets logged into a table (ItemLog).
So then where I become unstuck is I want:
A total number of records.A total number of records for each of the items in big long list.Then be able to break the records down by date.... Would I need to write out a lot of count statements in sql?
In my employe db i want only employes who has a specific word in a column to be viewed in my repeater.
lets say we have names of the employes in one column and what department they belong to in the other column.
If a employe belongs to "economic" department and i want to only show the persons that works in that apartment.
What sql query could i use for that?
something like this ?:
SELECT * FROM [employes] WHERE ([apartment] LIKE '%' + economic + '%')
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]....
I have a table 'articles' where all the articles are stored and I want to create a search engine for my website.
user types the keywords in the search engine and what code i should use to search the records in my database?
I am creating an insert statement in my c# code to insert records to an access database table. I am getting the error copied below using c# code. When I copy the generated insert statement from the console and run this on my access database, it succesfully appends a record in the table.Insert statement generated:
insert into [Pet Fish-log 2010] ([Specimen Type], Year, [Lab Number], [Last Name], [First Name], [Middle Initial], Gender, [Date of Birth], [Collection Date], [Date Received], Client, [Tissue Type], [Block Number],
[code]......
that is i want to delete my all he data of database but i want taht all the tables a andreletion will be remain same how can i do it easily
View 7 RepliesI have Gridview on my webapplication and it is getting filled with multiple rows . When clicked on Save I want to Insert all rows without calling multiple database hits.
Is there any way I can insert all rows by single db hit?
how can i write a sql to execute the file at specific time sql server database.
View 3 RepliesMy code is not updating the sql database. I am definately passing the correct information in to this function, and it runs without errors. If I exec the procedure with the passed in data, it works great. Can someone tell me what is missing?
public DataTable UpdateEmailList(int listId, string connectionString, DataTable EmailList)
{
//DataTable dt = new DataTable();
SqlConnection conn = new SqlConnection(connectionString);
conn.Open();
SqlDataAdapter da = new SqlDataAdapter(null, conn);
SqlCommand cmd = null;
//add
cmd = new SqlCommand("dbo.fp_ServiceAwards_AddEmailToList", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("@emailList_id", SqlDbType.Int)).Value = listId;
cmd.Parameters.Add(new SqlParameter("@email_address", SqlDbType.NVarChar, 255, "email_address"));
cmd.Connection = conn;
da.InsertCommand = cmd;
//delete
cmd = new SqlCommand("dbo.fp_ServiceAwards_DeleteEmailFromList", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("@emailList_id", SqlDbType.Int)).Value = listId;
cmd.Parameters.Add(new SqlParameter("@email_address", SqlDbType.NVarChar, 255, "email_address"));
cmd.Connection = conn;
da.DeleteCommand = cmd;
try
{
da.Update(EmailList);
}
catch (Exception ex)
{
string msg = ex.Message;
}
conn.Close();
conn.Dispose();
return EmailList;
}
How to write a Sql Query for insert, Delete for Image from sql server 2005.
View 2 RepliesI've have to delete multiple rows from database in a table . Which is the best way to delete data to optimize performance of sql server as well as asp.net.
View 6 Replies