Dropdownlist sql database kaynakli
<%@ Import Namespace="System.Data.SqlClient" %>
<script runat="server">
sub Page_Load
Dim baglanti as SqlConnection
baglanti = New SqlConnection("Data Source=server;" _
& "Initial Catalog=database;User Id=username;Password=sifre;" _
& "Connect Timeout=15;Network Library=dbmssocn;"
baglanti.Open()
Dim komut As SqlCommand
Dim data as SqlDataReader
komut= New SqlCommand("select * from tbl_test ",conPubs)
data= komut.ExecuteReader()
droptest.datasource = data
droptest.datatextfield = "fieldismi"
droptest.databind()
data.close()
baglanti.close()
End Sub
</script>
<html>
<head><title>Employee Data</title></head>
<body>
<center><h2>TEST1</h2></center>
<p>
<form id="Form1" runat="server">
<asp:dropdownlist id="droptest" runat="server" />
</form>
</body>
</html>