Link to home
Create AccountLog in
Avatar of sweeting89
sweeting89

asked on

DropDownList, select two values to insert a third value error

i am trying to select a fixture date in combination with the team playing on that date in a dropdownlist, which when selected will then insert the fixture ID associated with the details in the DDL to an sql table on button click.

however with the method i try i get the error 'The data types date and varchar are incompatible in the add operator.'
<asp:DropDownList ID="DropDownList2" runat="server" 
                    DataSourceID="SqlDataSource2" DataTextField="Fixture_ID" 
                    DataValueField="FixtureID">
                </asp:DropDownList>
                <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:loughtonccConnectionString %>" 
                    SelectCommand="SELECT ([Fixture_Date] +' '+ [Team_Name]) as FixtureID, [Fixture_ID] FROM [Fixture]">
                </asp:SqlDataSource>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Mlanda T
Mlanda T
Flag of South Africa image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of sweeting89
sweeting89

ASKER

Brilliant solution, easy to understand and worked very nicely!