web 2.0

ASP.NET(vb.net) SqlDataSource & DataBind

ASP.NET(vb.net) SqlDataSource & DataBind Example code how to use ASP.NET and SqlDataSource for create DataSource and bind data to GridView (for Code)

ShotDev Focus:
- ASP.NET(vb.net) SqlDataSource & DataBind

Example

AspNetSqlDataSourceDataBind.aspx

<%@ import Namespace="System.Configuration" %>
<%@ Page Language="VB" %>
<script runat="server">

Sub Page_Load(sender As Object, e As EventArgs)

Dim myDSource As New SqlDataSource
With myDSource
.ConnectionString = System.Configuration.ConfigurationSettings.AppSettings("ConnectionString")
.SelectCommand = "SELECT * FROM [customer]"
End With

Me.myGridView.DataSource = myDSource
Me.myGridView.DataBind()

End Sub

</script>
<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<form id="form1" runat="server">
<asp:GridView id="myGridView" runat="server" AutoGenerateColumns="True"></asp:GridView>
</form>
</body>
</html>

Create a asp.net file and save to path root-path/dotnet/

Run
http://localhost/dotnet/AspNetSqlDataSourceDataBind.aspx

Screenshot

ASP.NET(vb.net) SqlDataSource & DataBind
.
.
.

Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (No Ratings Yet)
Loading ... Loading ...

Leave a Reply

You must be logged in to post a comment.