I am trying to display all records that match the last name entered into a textbox. This requires an INNER JOIN on the "volID" column because there are 2 tables.
<asp:TextBox ID="lName" runat="server"></asp:TextBox>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="true" Visible="true"></asp:GridView>
<asp:linkButton ID="btnSubmit" runat="server" onclick="btnSubmit_Click" />
Code behind:
protected void btnSubmit_Click(object sender, EventArgs e)
{
GridView1.DataSource = new Select("*")
.From(PastAwardName.Schema)
.InnerJoin(PastAwardName.VolIDColumn, PastAwardType.VolIDColumn)
.Where(PastAwardName.Columns.LName).IsEqualTo(this.lName.Text)
.ExecuteReader();
GridView1.DataBind();
}
I tried to do this from and example on Subsonics site but cannot get it working. Geeting the error below.
Server Error in '/' Application.
________________________________________
The objects "dbo.pastAwardNames" and "dbo.pastAwardNames" in the FROM clause have the same exposed names. Use correlation names to distinguish them.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: The objects "dbo.pastAwardNames" and "dbo.pastAwardNames" in the FROM clause have the same exposed names. Use correlation names to distinguish them.
Source Error:
Line 30:
Line 31:
Line 32: GridView1.DataSource = new Select("*")
Line 33: .From(PastAwardName.Schema)
Line 34: .InnerJoin(PastAwardName.VolIDColumn, PastAwardType.VolIDColumn)