Я пытаюсь отобразить все записи, которые соответствуют фамилии, введенной в текстовое поле.
Это требует ВНУТРЕННЕГО СОЕДИНЕНИЯ для столбца «volID», потому что есть 2 таблицы.
<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" />
Код:
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();
}
Я пытался сделать это с примера на сайте Subsonics, но не могу заставить его работать. Получив ошибку ниже.
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)