Hello, I was able to successfully bind combo boxes to data. Now I need your help again (jennifer?
) Here's my code that works:
<%@ Page Language="VB" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>
<script runat="server">
Sub Page_Load(sender As Object, e As EventArgs)
' Create a connection to the "pubs" SQL database located
' on the local computer.
Dim myConnection As SqlConnection
Dim myCommand As SqlDataAdapter
Dim myCommand2 As SQlDataAdapter
' Connect to the SQL database using a SQL SELECT query to get
' all the data from the "Products" table.
myConnection = New SqlConnection("server=x;database=x;user id=x;pwd=x")
myCommand = New SqlDataAdapter("SELECT nameofschool FROM schools",myconnection)
myCommand2 = New SqlDataAdapter("SELECT name FROM healthclubs ",myconnection)
' Create and fill a DataSet.
Dim dsschools As Dataset = new DataSet()
Dim dshealth As Dataset = new DataSet()
myCommand.Fill(dsschools)
myCommand2.Fill(dshealth)
PriceBox.DataSource = dsschools
PriceBox.DataTextField = "nameofschool"
PriceBox.DataValueField = "nameofschool"
PriceBox.DataBind()
AgentNameBox.DataSource = dshealth
AgentNameBox.DataTextField = "name"
AgentNameBox.DataValueField = "name"
AgentNameBox.DataBind()
End Sub
</script>
<html>
<head>
</head>
<body style="FONT-FAMILY: arial">
<form>
<select id="PriceBox" style="FONT-SIZE: 8.6pt; FONT-FAMILY: Verdana" runat="server">
</select>
<select id="agentnamebox" style="FONT-SIZE: 8.6pt; FONT-FAMILY: Verdana" runat="server">
</select>
</form>
</body>
</html>
*******
Now I want to add a textbox control which will take the source from a sql statement like: select price from prices where id = 5.... thanks!
<%@ Page Language="VB" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>
<script runat="server">
Sub Page_Load(sender As Object, e As EventArgs)
' Create a connection to the "pubs" SQL database located
' on the local computer.
Dim myConnection As SqlConnection
Dim myCommand As SqlDataAdapter
Dim myCommand2 As SQlDataAdapter
' Connect to the SQL database using a SQL SELECT query to get
' all the data from the "Products" table.
myConnection = New SqlConnection("server=x;database=x;user id=x;pwd=x")
myCommand = New SqlDataAdapter("SELECT nameofschool FROM schools",myconnection)
myCommand2 = New SqlDataAdapter("SELECT name FROM healthclubs ",myconnection)
' Create and fill a DataSet.
Dim dsschools As Dataset = new DataSet()
Dim dshealth As Dataset = new DataSet()
myCommand.Fill(dsschools)
myCommand2.Fill(dshealth)
PriceBox.DataSource = dsschools
PriceBox.DataTextField = "nameofschool"
PriceBox.DataValueField = "nameofschool"
PriceBox.DataBind()
AgentNameBox.DataSource = dshealth
AgentNameBox.DataTextField = "name"
AgentNameBox.DataValueField = "name"
AgentNameBox.DataBind()
End Sub
</script>
<html>
<head>
</head>
<body style="FONT-FAMILY: arial">
<form>
<select id="PriceBox" style="FONT-SIZE: 8.6pt; FONT-FAMILY: Verdana" runat="server">
</select>
<select id="agentnamebox" style="FONT-SIZE: 8.6pt; FONT-FAMILY: Verdana" runat="server">
</select>
</form>
</body>
</html>
*******
Now I want to add a textbox control which will take the source from a sql statement like: select price from prices where id = 5.... thanks!