detele.aspx ( File view )

  • By 2010-12-20
  • View(s):5
  • Download(s):0
  • Point(s): 1
			<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>

<html>
 

<script language="VB" runat="server">

    Dim MyConnection As SqlConnection

    Sub Page_Load(Sender As Object, E As EventArgs)

        MyConnection = New SqlConnection("server=sunny;database=山景社区医院;user id=sa;password=sa;connect timeout=30")

        If Not (IsPostBack)
            BindGrid()
        End If
    End Sub

    Sub MyDataGrid_Delete(Sender As Object, E As DataGridCommandEventArgs)

        Dim MyCommand As SqlCommand
        Dim DeleteCmd As String = "DELETE from physician where yid= @Id"

        MyCommand = New SqlCommand(DeleteCmd, MyConnection)
        MyCommand.Parameters.Add(New SqlParameter("@Id", SqlDbType.Char, 20))
        MyCommand.Parameters("@Id").Value = MyDataGrid.DataKeys(CInt(E.Item.ItemIndex))

        MyCommand.Connection.Open()

        Try
            MyCommand.ExecuteNonQuery()
            Message.InnerHtml = "<b>已删除记录</b><br>" & DeleteCmd
        Catch Exc As SQLException
            Message.InnerHtml = "错误:未能删除记录"
            Message.Style("颜色") = "蓝色"
        End Try

        MyCommand.Connection.Close()

        BindGrid()
    End Sub

    Sub BindGrid()

        Dim DS As DataSet
        Dim MyCommand As SqlDataAdapter
        MyCommand = New SqlDataAdapter("select * from physician", MyConnection)

        DS = new DataSet()
        MyCommand.Fill(DS, "physician")

        MyDataGrid.DataSource=DS.Tables("physician").DefaultView
 
...
...
(Please download the complete source code to view)
			
...
Expand> <Close

Want complete source code? Download it here

Point(s): 1

Download
0 lines left, continue to read
Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
welcome.gif1.34 kB11-06-01|11:26
j2ee_info.gif1.33 kB31-08-04|05:07
web.config102.00 B15-04-05|21:51
index.aspx703.00 B15-04-05|23:02
about.aspx898.00 B15-04-05|23:14
shangzai.txt54.48 kB19-11-05|13:30
datagrid.aspx1.00 kB14-04-05|23:07
detele.aspx2.30 kB15-04-05|20:05
execute_reader.aspx890.00 B14-04-05|22:48
foot.inc666.00 B15-04-05|09:54
head.inc1.28 kB15-04-05|23:08
insert.aspx4.59 kB15-04-05|19:59
main.aspx2.90 kB15-04-05|23:03
default.aspx1.01 kB15-04-05|23:06
replace.aspx6.19 kB15-04-05|20:25
search.aspx6.27 kB15-04-05|20:26
sql_connection.aspx1.54 kB14-04-05|22:29
22.gif2.64 kB07-10-02|20:00
DataSet.aspx1.19 kB15-04-05|10:47
Edit.aspx1.93 kB15-04-05|11:17
BackTop.GIF59.93 kB07-10-02|20:00
44.gif18.05 kB07-10-02|20:00
b3.gif6.79 kB28-12-04|17:49
niao.gif1.06 kB28-12-04|17:49
...
Sponsored links

detele.aspx (104.98 kB)

Need 1 point
Your Point(s)

Your Point isn't enough.

Get point immediately by PayPal

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more point

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com

切换到中文版?

CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D