Learn how to a build a cloud-first strategyRegister Now


How to delete data from a 2005 SQL Express table...

Posted on 2011-05-02
Medium Priority
Last Modified: 2012-06-27
I have a problem with deleting data from tables in SQL Express 2005.

I am new to Visual Studio 2008 and Visual Basic 2008 data access, and am trying to write some code to learn about them.

The problem that I have is that I have added 2 records to a table and cannot seem to delete either record from the Visual Studio 2008 interface to the table data.

I have uploaded a video to http://www.mediafire.com/?58btnvo1m2m6679 so that you can see exactly what my problem is.

Any help would be greatly appreciated.
Question by:cerksees
LVL 83

Expert Comment

ID: 35508480
Can you show us the code you are using to delete rows?
LVL 17

Accepted Solution

Carlos Villegas earned 2000 total points
ID: 35508941
Hi cerksees, I saw your video (nice), you will need to add a primary key column to your Dates table, for example, add a column named DateId, type Int, and mark it as Primary Key, then in your column properties, set this column has an identity column, save the table, that will fix your problem.
Here a screen shot:
I think that you are stuck on that because VS designer is not letting you to delete that records, If you want to delete all the data in your table just execute this command by using the SQL Server Management Studio Express:

Open in new window

This is a way to fix your problem, but you need to analyze your data, maybe you dont need add an extra column, maybe you can mark the Date column as a primary key and you are done.

Sorry if I dont understand fully your explanation, english is not my first language.

Author Closing Comment

ID: 35509263
Excellent.  BTW, anyone that needs this can get the Microsoft SQL Server Management Studio Express for Sql Express 2005 from http://www.microsoft.com/downloads/en/details.aspx?FamilyId=C243A5AE-4BD1-4E3D-94B8-5A0F62BF7796&DisplayLang=en.

Be sure and run it from a command line with the command window run as an administrator.  If you don't it may not install correctly.

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month20 days, 21 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question