Latest developer linksBookmark and Share
 
HomeThis WeekTop MonthTop AlltimeSearchRegisterFAQ
  
 
Submit Your Link
Please login to submit your Link
 

how to delete a specific row from a database

Posted: Jan/22/2011   By: nikhil   Points:15   Category: .NET  - ASP.Net    Views:121   Vote Up (0)   Vote Down (0)    

Hi...

i have started to learn SQL but i have a problem in a command can anyone help

i have a table with a single column and i want to delete a specific row so how can i do

suppose i have a column names..

Name

john

sara

Tom

green

 

now how can i delete the record that is on the second place???? without explicitly saying "Sara"

i need help with SQL Command

Thanks in advance

 

View Complete Post


Comments:
Be the first to comment this post.
 
Post Comment
Please login to post your comment
More Related Resources

Gridview paging and multiple row delete using checkbox

  
This article gives you information about GridView paging and multiple row deletion using CheckBox selection and LINQ.

Delete Rows in GridView in ASP.Net 2.0

  
Read the previous code snippet to edit/update in a GridView here. I have disabled AutoGenerateColumns and declared the columns explicitly. In the below code snippet, I have made the delete button to appear as first column.

Display Confirm Message box on delete row in a gridview

  
you can use javascript confirm() dialog for asking user confirmation to delete records or not?

How to import existing database into Webmatrix?

  

I am planning to use Webmatrix as a testing arena for creating and completing the preparation of a website before publishing it. Working with websites on local computer should be much faster than doing that on an online server.

That is why I downloaded a database that I have already created on my online host account, and wanted to import it into webmatrix to continue building my new website using Webmatrix. Here, I did not know how to imort the DB I downloaded from my host, into webmatrix. There is seemingly no way to do that, or to import tables into an existing DB on webmatrix. 

Is that not possible? 

2- I tried to create a new DB on webmatrix which is a part of installing Wordbress on WM (new site from web gallery --> Wordpress), but I get this error :

The database 'xxxx' could not be created. ---> MySql.Data.MySqlClient.MySqlException: Unable to connect to any of the specified MySQL hosts. ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:3306


I have installed PHP 5.2 and Mysql on Webmatrix. 


Why does this happen?


how to open a database in a webmatrix C# file?

  

In the webMatrix examples, which I have working, it's very easy to access a database. Only three lines are necessary to get up and going:

@{ 
    var db = Database.Open("LOS");  
    var selectQueryString = "SELECT * FROM wknTest"; 
} 

and a little later,

 @foreach(var row in db.Query(selectQueryString)){  

There's no using's, no connection strings, all that happens behind the scenes. But now I have enough complicated c# code that I want to separate it into a separate C# file. How would I do the above, but in a C# file residing in the app_code folder in a webMatrix project? 

WebMatrix must be creating the Database object behind the scenes.  So I'm really asking how do I have access to that.


Webmatrix.Data.Database.Query() method return type

  

I'm using the Webmatrix.Data.Database.Query method to return a result set in the following form

var myResult = db.Query("Select * from mytable");

How do you cast myResult to get the count of records returned? I'd like to do something like

   myResult.Count


Does Dynamic Data support soft delete feature?

  

Due to auditing purpose, we are not supposed to delete records from the database. Instead we update a flaf which will mark it as deleted. Is there a way to accomplish this is Dynamic Data?

 At current I am overriding the partial method in datacontext and executing my own query. I wanted to check if other members in the community have a different approach.


-please delete that entry

  

-please delete that entry


Login Control with SQL Database

  

Hello,

I'm in a trouble with the Login Control of ASP.NET to check the credentials against an SQL Database.

I followed all the instructions from http://www.aspxcode.net/free-asp-net-login-source-code.aspx?Topics=How to Login With SQL Server Database but I have errors.

 

In a master page, I added a Login Control as follows:

<asp:LoginView ID="LoginView1" runat="server">
                <AnonymousTemplate>
                    <asp:Login ID="Login1" runat="server" OnAuthenticate="Login1_Authenticate" BorderPadding="0"
                        BorderStyle="None" BorderWidth="0px" EnableTheming="True" Font-Names="Arial"
                        Font-Size="X-Small" ForeColor="#333333" LoginButtonImageUrl="~/imgs/nav/en/Login.gif"
                        LoginButtonType="Image" TitleText="" TextLayout="TextOnTop" Width="120px" RememberMeText="Remember me.">
                        <CheckBoxStyle VerticalAlign="Middle" HorizontalAlign="Left" />
                        <InstructionTextStyle Font-Italic="True" ForeColor="Black" />
                        <LabelStyle HorizontalAlign="Left" Width="130px" />
                        <LoginButtonStyle BackColor="#FFFBFF" BorderColor="#CCCCCC" BorderStyle="None" Font-Names="Arial"
                            Font-Size="X-Small" ForeColor="#284775" CssClass="loginBox" />
                        <TextBoxStyle Font-Size="X-Small" Width="120px" />
                        <TitleTextStyle BackColor="#5D7B9D" Font-Bold="True" Font-Size="X-Small" ForeColor="White" />
                    </asp:Login>               
                </AnonymousTemplate>
                <LoggedInTemplate>
                    <asp:LoginName ID="LoginName1" runat="server" /><br />
                    <asp:LoginStatus ID="LoginStatus1" runat="server" />
                </LoggedInTemplate>
                </asp:LoginView>

 

Also, I have implemented an internet found class to the project to connect, OnAuthenticate, to the SQL Database. The code is the following:

Imports System.Data
Imports System.Data.SqlClient
Imports System.Web.Configuration

Partial Class how_to_login_with_sql_server
    Inherits System.Web.UI.MasterPage

 &nb

When choosing POCO, First Model or the EDMX created from the database?

  

Good morning, this is my first post here.

I will make a system that will be sold at retail, placed in the clouds. The EDMX created from the database seemed the most natural choice since in reality the database exists and is already populated, it has a lot of data.

The First Model did not seem a natural solution since it is difficult today a completely new solution, and the examples I saw did not show me because I use it.

About POCO, what advantages do I have using it?

Thanks,

Bruno


 
Categories:
.NET
Java
PHP
C/C++/VC++
HTML/XML
SAP
MainFrames
Data Warehousing
Testing
MySQL
SQL Server
Oracle
Javascript/VB Script
Others
Login
 
 
 
 
 Forgot password
 Contact Us   Terms Of use   Share your knowledge