Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need help combo box empty trying to fill with SQL server on hosted site

Status
Not open for further replies.

DougP

MIS
Dec 13, 1999
5,985
US
I want to use a SQL server on my hosted WEB site. using Microsoft SQL Server Management Studio R8 ver. 10.50.1617.0. I can connect and query data etc.
In Visual WEB Developer Express 2010 I can click on the combo configure the data source and drill down thru to see valid records and test it. it returns results just fine.

Viewing the WEB site either on my local machine or the hosted WEB site the combo box is empty.
No errors, no nothing. a page with an empty combo box. Can anyone see anything wrong or missing. I created the connection string by scratch in the WEB config file.

WEB config file
Code:
 <connectionStrings>
    <add name="DatabaseExternalConnectionString" connectionString="Data Source=mywebsite.com; Initial Catalog=mydb; User Id=myuser; Password=Pass;" providerName="System.Data.SqlClient"/>

aspx page
Code:
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div>
       Choose Part #
        <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" 
            DataSourceID="SqlDataSource1" DataTextField="PartNum" 
            DataValueField="PartNum">
            <asp:ListItem Selected="True">Choose part</asp:ListItem>
        </asp:DropDownList>
    </div>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:DatabaseExternalConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:DatabaseExternalConnectionString.ProviderName %>" 
        SelectCommand="SELECT [PartNum], [ID], [Description], [Qty], [VendorID] FROM [Inventory] WHERE ([PartNum] = @PartNum)">
        <SelectParameters>
            <asp:ControlParameter ControlID="DropDownList1" Name="PartNum" 
                PropertyName="SelectedValue" Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>
</asp:Content>


DougP
 

Is mywebsite.com the actual SQL Server instance name (connection string)?


Mark

"You guys pair up in groups of three, then line up in a circle."
- Bill Peterson, a Florida State football coach
 
No I changed the data to protect the Innocent
But the "real" connection string works in several other apps: vb.net, SQL man studio, classic asp. so I know what I am using is correct.

DougP
 
Are you trying to use the selected value of the dropdown you're trying to fill as a parameter of the query that fills the drop down?

Lodlaiden

You've got questions and source code. We want both!
Oh? That? That's not an important password. - IT Security Admin (pw on whiteboard)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top