473,774 Members | 2,176 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

delete command

I was able to figure out how to insert new data into my database. But for
some reason and a lot of reading I can't seem to figure out how to delete
any data.

My app is going to be used for tracking info on vehicles. My app is MDI
with 3 children. 1 is for selecting a car(already in the database) and input
info.Then you can add that car and info to the database. Another is used for
just adding or deleting a car to the database. The 3rd is where the data is
viewed via a datagrid. I have 2 tables. 1 is car names, carID,
model,Etc..the other is for maintenance logs ie miles and etc....

Either I just don't get it or the method for deleting data is not explained
very well. I have been only using .NET for a few months and have very
little programming experience.

I need to be able to delete the car name from the NameTable and then delete
all info on that car from the carinfotable.

If anyone can point me in the right direction I would be greatful
Thx in advance.
Jul 21 '05 #1
7 1726
In a database relationship declared ON DELETE RESTRICT you would need to
delete all rows in the child table carinfotable before you can delete
the parent
row. If you want you can change ON DELETE RESTRICT to ON DELETE
CASCADE which automatically deletes andy carinfotable rows related to
the
car name row.

Regards,
Jeff
I need to be able to delete the car name from the NameTable and then
delete
all info on that car from the carinfotable.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 21 '05 #2
Mike & Dyan

In dotNet there can be a lot of methods be used to get the data, according
to that there are a lot of methods to delete the data. Can you tell
something more about that.

Do you use in General
AdoNet
AdoDB
Any other method

Than when Adonet by instance
By a datareader or by a dataset

And more of this kind of information.

Not you got from Jeff an answer using direct SQL however one of the
thousands to choose form probably..

Cor
Jul 21 '05 #3
In addition to the information Cor asked for, can you also tell us:

Are you storing your data in SQL Server (full version or MSDE), Access, or
some other database?
Are you familiar with SQL queries? (INSERT, SELECT, DELETE)
Are you familiar with stored procedures?
What information forms the primary key for your NameTable?
What information forms the foreign key for the carinfotable?

While Jeff responded with a very technical answer, I'd like to repeat one of
the key points he made:
If you are using referential integrity in your database, you will have to
delete rows from the carinfotable first and then from the NameTable. I
would add: If you are not using referential integrity in your database, you
should be. ;-)

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Mike & Dyan" <mi******@comca st.net> wrote in message
news:M5******** ************@co mcast.com...
I was able to figure out how to insert new data into my database. But for
some reason and a lot of reading I can't seem to figure out how to delete
any data.

My app is going to be used for tracking info on vehicles. My app is MDI
with 3 children. 1 is for selecting a car(already in the database) and
input info.Then you can add that car and info to the database. Another is
used for just adding or deleting a car to the database. The 3rd is where
the data is viewed via a datagrid. I have 2 tables. 1 is car names, carID,
model,Etc..the other is for maintenance logs ie miles and etc....

Either I just don't get it or the method for deleting data is not
explained very well. I have been only using .NET for a few months and
have very little programming experience.

I need to be able to delete the car name from the NameTable and then
delete all info on that car from the carinfotable.

If anyone can point me in the right direction I would be greatful
Thx in advance.

Jul 21 '05 #4


Like I said I have very little programming experience. I am doing this
for a friend and because I would like to learn how to program. I do not
know if I have set the database relationship declared to anything or
not. How and where would I look to verify this.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 21 '05 #5
Mike... Database administration alone is a full time job. Writing
database GUIs
alone is a full time job. It is somewhat rare to find someone good at
both. In
your project go to the service explorer, select the database, create a
new
database diagram, add all the tables, right click on the relationship
arrow and
select properties, select relationships. If you are new to databases
check out:

Database Design For Mere Mortals Hernandez

If you want to go crazy read:

An Introduction to Database Design Date
Handbook of Relational Database Design von Halle

If you are using MSDE, SQL

Inside SQL Server Soukup
Transact-SQL Programming Kline

Regards,
Jeff
Like I said I have very little programming experience. I am doing this
for a friend and because I would like to learn how to program. I do not
know if I have set the database relationship declared to anything or
not. How and where would I look to verify this.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 21 '05 #6
Before I go any further I would like to thank you for your help. I
followed the instructions to make a database diagram that visual studio
said to do. in server explorer there is suppose to be a database
diagrams folder. Well I do not have one. Is there a way to make one or
is there an option that I don't have enalbed and that is why I don't
have a database diagrams folder????

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 21 '05 #7
Mike...It is pretty hard to figure out what you can see from a
newsgroup. You should see a database connections icon. If you add a
database connection you should be able to expand the connection and see
a database diagrams icon. You should then be able to add a database
diagram.

Regards,
Jeff
I followed the instructions to make a database diagram that visual
studiosaid to do. in server explorer there is suppose to be a database
diagrams folder. Well I do not have one.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 21 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2873
by: sql-db2-dba | last post by:
There are 2 tables A and B with A being the parent of B. Table A ( Col1 varchar(5) Not Null ) Table B ( B_PK varchar(5) Not Null ,
9
5924
by: Toralf Kirsten | last post by:
Hi, we installed db2 v8.1 on red hat linux 9. Unfortunately, the backspace and the delete button doesn't work in the right way. Instead of deleting chars, control characters are inputed. That makes it very hard to input sql commands at the db2 command line prompt. For example: DB2> connect to aDatabase^?^?^?^?^[[3~^[[3~^[[3~ Is there the possibility to set an option / parameter anywhere? Thanks, Toralf
9
5724
by: Melissa | last post by:
What is the code to delete a command button from a form? Can the code be run from the click event of the button to be deleted? Thanks! Melissa
3
3451
by: Shapper | last post by:
Hello, I have created 3 functions to insert, update and delete an Access database record. The Insert and the Delete code are working fine. The update is not. I checked and my database has all the necessary records in it when testing it. I get the error "No value given for one or more required parameters." when I try to update the database. Can you tell me what am I doing wrong?
3
13753
by: NateDawg | last post by:
I'm reposting this. I'm kinda in a bind untill i get this figured out, so if anyone has some input it would sure help me out. Ok, I’ve noticed a few gridview problems floating around the forum. Everyone wants to do a java confirmation box when a user clicks the delete button. Fair enough, basic user design rules state that you should always confirm a delete action. There is also a consensus that the best way to do this is a template...
5
9937
by: Neil | last post by:
I am getting time-out errors when I try to perform a simple delete on a linked server. The command is: Delete From MyTable Where PKID=12345 I have tried executing this command directly from Query Analyzer, but it just times out. However, when I run it from QA against the server itself (rather than from my local server against a linked server), it executes immediately. Similarly, if I run the same SQL command through an ODBC linked...
3
3812
by: Kevin M | last post by:
I have one table and have created a form from that table. Also, I have created a delete query. I want to but a button on the form which will delete all records from the table; however, I cannot get anything to work. I know this is probably simple for more experienced Access users. Any help would be greatly appreciated. Thanks Kevin
1
8580
by: Barry L. Camp | last post by:
Hi all, Wondering if someone can help with a nagging problem I am having using a GridView and an ObjectDataSource. I have a simple situation where I am trying to delete a row from a table, but it doesn't seem to work at all. Below is my ASP.NET page, and further below, my VB.NET method that I am trying to call: <div id="admin-faq" class="page"> <h2>Site FAQs (Frequently Asked Questions)</h2>
1
2338
by: jmarcrum | last post by:
Hello all! i have a “monitor-type” program, where my program recognizes my defined "commands”, and executes the given command, or produces an error message that says “unrecognized command”. After execution or error message, the program puts the cursor on the next line, and waits for the next command. i have two commands that I CANNOT SEEM TO GET TO WORK...addDVD and deleteDVD. I just learned that I can't use an array, because i "must"...
10
7172
beacon
by: beacon | last post by:
Hi everybody, This is probably going to sound unorthodox, but I have to log records that are deleted...I know, go figure. Anyway, I have a form with a (continuous) subform, and on the subform I have a command button, called cmdDelete, that launches a dialog form, called frmDeleteCurrentRecord, where the user has to enter their name and a reason. I have managed, through a ton of trial and tribulation, found a way to delete the current...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10267
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10040
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8939
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7463
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3611
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2852
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.