'2 add record
Mycommand = new sqlcommand ("insert into [test] (name, sex) values ('huang Zhiwen ', 'male ')",
Myconnection)
Mycommand. executenonquery ()
La3.text = "New Record inserted! "
'3 update data
Mycommand = new sqlcommand ("Update [test] Set Name = 'Smith 'Where name = 'lilim'", myconnection)
Mycommand. executenonquery ()
La4.text = "record updated! "
'4 deleting data
Mycommand = new sqlcommand ("delete from [test] Where name = 'Smith '", myconnection)
Mycommand. executenonquery ()
La5.text = "record deleted! "
'5 display data with DataGrid
Mycommand = new sqlcommand ("select * from [test]", myconnection)
Mydatagrid. datasource = mycommand. executereader ()
Mydatagrid. databind ()
End sub
</SCRIPT>
<HTML>
<Body>
<Asp: Label id = "la1" runat = "server"/> <br>
<Asp: Label id = "La2" runat = "server"/> <br>
<Asp: Label id = "La3" runat = "server"/> <br>
<Asp: Label id = "la4" runat = "server"/> <br>
<Asp: Label id = "LA5" runat = "server"/> <br>
<Asp: DataGrid id = "mydatagrid" runat = "server"
Bordercolor = "black"
Borderwidth = "1"
Gridlines = "both"
Cellpadding = "3"
Cellspacing = "0"
Font-name = "verdana"
Font-size = "10pt"
Headerstyle-backcolor = "# aaaadd"
Alternatingitemstyle-backcolor = "# eeeeee"
>
</ASP: DataGrid>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service