Update Sql Server Data : Update SqlConnection « ADO.net Database « ASP.Net

Home
ASP.Net
1.ADO.net Database
2.Ajax
3.Asp Control
4.Collections
5.Components
6.Data Binding
7.Development
8.File Directory
9.HTML Control
10.Language Basics
11.Login Security
12.Mobile Control
13.Network
14.Page
15.Request
16.Response
17.Server
18.Session Cookie
19.Sitemap
20.Theme Style
21.User Control and Master Page
22.Validation by Control
23.Validation by Function
24.WebPart
25.WPF
26.XML
ASP.Net » ADO.net Database » Update SqlConnection 
Update Sql Server Data

<%@ Page Language=VB Debug=true %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SQLClient" %>
<script runat=server>
Sub Page_Load(ByVal Sender as Object, ByVal E as EventArgs)
End Sub
Sub SubmitBtn_Click(Sender As Object, E As EventArgs)
    Dim DBConn as SQLConnection
    Dim DBUpdate As New SQLCommand
'        DBConn = New SQLConnection("server=localhost;" _
 '           "Initial Catalog=TT;" _
  '          "User Id=sa;" _
   '         "Password=yourpassword;")
    DBConn = New SQLConnection("Data Source=whsql-v08.prod.mesa1.secureserver.net;Initial Catalog=DB_49907;User ID=java2suser;Password='password';")
    DBUpdate.CommandText = "Update Employee Set " _
        "Salary = Salary * " & txtRaise.Text
    DBUpdate.Connection = DBConn
    DBUpdate.Connection.Open
    DBUpdate.ExecuteNonQuery()
End Sub
</SCRIPT>
<HTML>
<HEAD>
<TITLE>Updating SQL Server Data</TITLE>
</HEAD>
<Body LEFTMARGIN="40">
<form runat="server">
Enter the raise for all employees. For example, enter 1.25 for 25% raise:
<BR>
<asp:textbox
    id="txtRaise"
    runat="Server"
/>
<BR><BR>
<asp:button 
    id="butOK"
    text="  OK  "
    onclick="SubmitBtn_Click" 
    runat="server"
/>  
</form>
</BODY>
</HTML>
           
       
Related examples in the same category
1.Updating a database
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.